D1APP-27 news page (static)
This commit is contained in:
parent
0c92117205
commit
94098644fc
|
|
@ -1,3 +1,8 @@
|
||||||
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
|
import 'package:didvan/pages/home/news/widgets/news_item.dart';
|
||||||
|
import 'package:didvan/pages/home/radar/widgets/search_field.dart';
|
||||||
|
import 'package:didvan/pages/home/widgets/logo_app_bar.dart';
|
||||||
|
import 'package:didvan/widgets/didvan/card.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class News extends StatelessWidget {
|
class News extends StatelessWidget {
|
||||||
|
|
@ -5,6 +10,44 @@ class News extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container();
|
return Scaffold(
|
||||||
|
body: CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
const SliverToBoxAdapter(child: LogoAppBar()),
|
||||||
|
SliverPadding(
|
||||||
|
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||||
|
sliver: SliverToBoxAdapter(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SearchField(
|
||||||
|
title: 'اخبار',
|
||||||
|
onChanged: (value) {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {},
|
||||||
|
child: const Icon(
|
||||||
|
DidvanIcons.filter_regular,
|
||||||
|
size: 32,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SliverPadding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
sliver: SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) => const NewsItem(),
|
||||||
|
childCount: 10,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
import 'package:didvan/providers/core_provider.dart';
|
||||||
|
|
||||||
|
class NewsState extends CoreProvier {}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
import 'package:didvan/widgets/didvan/card.dart';
|
||||||
|
import 'package:didvan/widgets/didvan/text.dart';
|
||||||
|
import 'package:didvan/widgets/skeletun_image.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class NewsItem extends StatelessWidget {
|
||||||
|
const NewsItem({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16),
|
||||||
|
child: DidvanCard(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const SkeletonImage(
|
||||||
|
imageUrl: 'https://wallpapercave.com/wp/wp9373116.jpg',
|
||||||
|
width: 64,
|
||||||
|
height: 64,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 64,
|
||||||
|
child: DidvanText(
|
||||||
|
'بلاتکلیفی بازار فولاد به دلیل کاهش تقاضای جهانی',
|
||||||
|
style: Theme.of(context).textTheme.bodyText1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
const DidvanText(
|
||||||
|
'صنعت فولاد جوادی مجد سلیمی است پس باید به آن توجه زیادی شود تا بازار به انفجار نرسد. پس جواد مهربانگو باشیم.',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -38,14 +38,17 @@ class _RadarState extends State<Radar> {
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
slivers: [
|
slivers: [
|
||||||
const SliverToBoxAdapter(child: LogoAppBar()),
|
const SliverToBoxAdapter(child: LogoAppBar()),
|
||||||
const SliverPadding(
|
SliverPadding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||||
sliver: SliverToBoxAdapter(
|
sliver: SliverToBoxAdapter(
|
||||||
child: SearchField(),
|
child: SearchField(
|
||||||
|
title: 'رادار',
|
||||||
|
onChanged: (value) {},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding: const EdgeInsets.only(top: 300, right: 16, bottom: 20),
|
padding: const EdgeInsets.only(top: 284, right: 16, bottom: 20),
|
||||||
sliver: SliverToBoxAdapter(
|
sliver: SliverToBoxAdapter(
|
||||||
child: DidvanText(
|
child: DidvanText(
|
||||||
'آخرین رصد',
|
'آخرین رصد',
|
||||||
|
|
@ -54,13 +57,13 @@ class _RadarState extends State<Radar> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPadding(
|
SliverList(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
||||||
sliver: SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(_, index) => const RadarItem(),
|
(context, index) => const Padding(
|
||||||
childCount: 10,
|
padding: EdgeInsets.only(bottom: 20),
|
||||||
|
child: RadarItem(),
|
||||||
),
|
),
|
||||||
|
childCount: 10,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ class RadarItem extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return Padding(
|
||||||
onTap: () => Navigator.of(context).pushNamed(Routes.radarDetails),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: DidvanCard(
|
child: DidvanCard(
|
||||||
margin: const EdgeInsets.only(bottom: 20),
|
onTap: () => Navigator.of(context).pushNamed(Routes.radarDetails),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,11 @@ import 'package:didvan/constants/app_icons.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class SearchField extends StatefulWidget {
|
class SearchField extends StatefulWidget {
|
||||||
const SearchField({Key? key}) : super(key: key);
|
final String title;
|
||||||
|
final void Function(String? value) onChanged;
|
||||||
|
|
||||||
|
const SearchField({Key? key, required this.title, required this.onChanged})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SearchField> createState() => _SearchFieldState();
|
State<SearchField> createState() => _SearchFieldState();
|
||||||
|
|
@ -31,7 +35,7 @@ class _SearchFieldState extends State<SearchField> {
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
style: Theme.of(context).textTheme.bodyText1,
|
style: Theme.of(context).textTheme.bodyText1,
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
onChanged: (value) {},
|
onChanged: widget.onChanged,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
textInputAction: TextInputAction.search,
|
textInputAction: TextInputAction.search,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
|
@ -46,6 +50,7 @@ class _SearchFieldState extends State<SearchField> {
|
||||||
prefixIcon: const Icon(
|
prefixIcon: const Icon(
|
||||||
DidvanIcons.search_regular,
|
DidvanIcons.search_regular,
|
||||||
),
|
),
|
||||||
|
prefixIconColor: Theme.of(context).colorScheme.inputText,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: const BorderRadius.all(
|
borderRadius: const BorderRadius.all(
|
||||||
Radius.circular(4),
|
Radius.circular(4),
|
||||||
|
|
@ -58,11 +63,11 @@ class _SearchFieldState extends State<SearchField> {
|
||||||
contentPadding: const EdgeInsets.only(
|
contentPadding: const EdgeInsets.only(
|
||||||
left: 12,
|
left: 12,
|
||||||
right: 12,
|
right: 12,
|
||||||
bottom: 8,
|
|
||||||
),
|
),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText: 'جستجو مطلب در رادار',
|
hintText: 'جستجو مطلب در ${widget.title}',
|
||||||
hintStyle: TextStyle(color: Theme.of(context).colorScheme.hint),
|
hintStyle:
|
||||||
|
TextStyle(color: Theme.of(context).colorScheme.disabledText),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,21 @@ class DidvanCard extends StatelessWidget {
|
||||||
final EdgeInsets? padding;
|
final EdgeInsets? padding;
|
||||||
final EdgeInsets? margin;
|
final EdgeInsets? margin;
|
||||||
final bool enableBorder;
|
final bool enableBorder;
|
||||||
|
final VoidCallback? onTap;
|
||||||
const DidvanCard({
|
const DidvanCard({
|
||||||
Key? key,
|
Key? key,
|
||||||
this.child,
|
this.child,
|
||||||
this.padding = const EdgeInsets.all(16),
|
this.padding = const EdgeInsets.all(16),
|
||||||
this.margin,
|
this.margin,
|
||||||
this.enableBorder = true,
|
this.enableBorder = true,
|
||||||
|
this.onTap,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return GestureDetector(
|
||||||
|
onTap: onTap,
|
||||||
|
child: Container(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
margin: margin,
|
margin: margin,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
@ -25,6 +29,7 @@ class DidvanCard extends StatelessWidget {
|
||||||
border: enableBorder ? DesignConfig.cardBorder : null,
|
border: enableBorder ? DesignConfig.cardBorder : null,
|
||||||
),
|
),
|
||||||
child: child,
|
child: child,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class DidvanPageView extends StatelessWidget {
|
||||||
vertical: 20, horizontal: 16),
|
vertical: 20, horizontal: 16),
|
||||||
sliver: SliverList(
|
sliver: SliverList(
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(_, index) {
|
(context, index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
return Column(
|
return Column(
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class DidvanScaffold extends StatelessWidget {
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
sliver: SliverList(
|
sliver: SliverList(
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(_, index) => slivers![index],
|
(context, index) => slivers![index],
|
||||||
childCount: slivers!.length,
|
childCount: slivers!.length,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue