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';
|
||||
|
||||
class News extends StatelessWidget {
|
||||
|
|
@ -5,6 +10,44 @@ class News extends StatelessWidget {
|
|||
|
||||
@override
|
||||
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,
|
||||
slivers: [
|
||||
const SliverToBoxAdapter(child: LogoAppBar()),
|
||||
const SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: SearchField(),
|
||||
child: SearchField(
|
||||
title: 'رادار',
|
||||
onChanged: (value) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(top: 300, right: 16, bottom: 20),
|
||||
padding: const EdgeInsets.only(top: 284, right: 16, bottom: 20),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: DidvanText(
|
||||
'آخرین رصد',
|
||||
|
|
@ -54,13 +57,13 @@ class _RadarState extends State<Radar> {
|
|||
),
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, index) => const RadarItem(),
|
||||
childCount: 10,
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) => const Padding(
|
||||
padding: EdgeInsets.only(bottom: 20),
|
||||
child: RadarItem(),
|
||||
),
|
||||
childCount: 10,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ class RadarItem extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(Routes.radarDetails),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: DidvanCard(
|
||||
margin: const EdgeInsets.only(bottom: 20),
|
||||
onTap: () => Navigator.of(context).pushNamed(Routes.radarDetails),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ import 'package:didvan/constants/app_icons.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
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
|
||||
State<SearchField> createState() => _SearchFieldState();
|
||||
|
|
@ -31,7 +35,7 @@ class _SearchFieldState extends State<SearchField> {
|
|||
focusNode: _focusNode,
|
||||
style: Theme.of(context).textTheme.bodyText1,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
onChanged: (value) {},
|
||||
onChanged: widget.onChanged,
|
||||
keyboardType: TextInputType.text,
|
||||
textInputAction: TextInputAction.search,
|
||||
decoration: InputDecoration(
|
||||
|
|
@ -46,6 +50,7 @@ class _SearchFieldState extends State<SearchField> {
|
|||
prefixIcon: const Icon(
|
||||
DidvanIcons.search_regular,
|
||||
),
|
||||
prefixIconColor: Theme.of(context).colorScheme.inputText,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(4),
|
||||
|
|
@ -58,11 +63,11 @@ class _SearchFieldState extends State<SearchField> {
|
|||
contentPadding: const EdgeInsets.only(
|
||||
left: 12,
|
||||
right: 12,
|
||||
bottom: 8,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
hintText: 'جستجو مطلب در رادار',
|
||||
hintStyle: TextStyle(color: Theme.of(context).colorScheme.hint),
|
||||
hintText: 'جستجو مطلب در ${widget.title}',
|
||||
hintStyle:
|
||||
TextStyle(color: Theme.of(context).colorScheme.disabledText),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,25 +6,30 @@ class DidvanCard extends StatelessWidget {
|
|||
final EdgeInsets? padding;
|
||||
final EdgeInsets? margin;
|
||||
final bool enableBorder;
|
||||
final VoidCallback? onTap;
|
||||
const DidvanCard({
|
||||
Key? key,
|
||||
this.child,
|
||||
this.padding = const EdgeInsets.all(16),
|
||||
this.margin,
|
||||
this.enableBorder = true,
|
||||
this.onTap,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: padding,
|
||||
margin: margin,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: DesignConfig.lowBorderRadius,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
border: enableBorder ? DesignConfig.cardBorder : null,
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: padding,
|
||||
margin: margin,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: DesignConfig.lowBorderRadius,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
border: enableBorder ? DesignConfig.cardBorder : null,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class DidvanPageView extends StatelessWidget {
|
|||
vertical: 20, horizontal: 16),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, index) {
|
||||
(context, index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return Column(
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class DidvanScaffold extends StatelessWidget {
|
|||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, index) => slivers![index],
|
||||
(context, index) => slivers![index],
|
||||
childCount: slivers!.length,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue