D1APP-37
This commit is contained in:
parent
33bcf52b08
commit
982389a367
|
|
@ -183,7 +183,7 @@ extension DidvanColorScheme on ColorScheme {
|
|||
? const Color(0XFFA3A3A3)
|
||||
: const Color(0XFF3D3D3D);
|
||||
Color get caption => brightness == Brightness.dark
|
||||
? const Color(0XFFD6D6D6)
|
||||
? const Color(0XFFBBBBBB)
|
||||
: const Color(0XFF666666);
|
||||
Color get hint => const Color(0XFFBBBBBB);
|
||||
Color get disabledText => brightness == Brightness.dark
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppBarData {
|
||||
final String? title;
|
||||
final String? subtitle;
|
||||
final bool hasBack;
|
||||
final Widget? trailing;
|
||||
|
||||
AppBarData({this.title, this.subtitle, this.hasBack = false});
|
||||
AppBarData({this.title, this.subtitle, this.hasBack = false, this.trailing});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
import 'package:didvan/config/theme_data.dart';
|
||||
import 'package:didvan/constants/app_icons.dart';
|
||||
import 'package:didvan/models/view/app_bar_data.dart';
|
||||
import 'package:didvan/widgets/didvan/badge.dart';
|
||||
import 'package:didvan/widgets/didvan/divider.dart';
|
||||
import 'package:didvan/widgets/didvan/scaffold.dart';
|
||||
import 'package:didvan/widgets/didvan/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChatList extends StatelessWidget {
|
||||
const ChatList({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DidvanScaffold(
|
||||
appBarData: AppBarData(
|
||||
hasBack: true,
|
||||
title: 'پیامها',
|
||||
trailing: const DidvanBadge(
|
||||
text: '12',
|
||||
),
|
||||
),
|
||||
slivers: [
|
||||
for (var i = 0; i < 10; i++)
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
DidvanIcons.avatar_light,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: DidvanText(
|
||||
'سردبیر رادار سیاسی',
|
||||
style: Theme.of(context).textTheme.bodyText1,
|
||||
),
|
||||
),
|
||||
const DidvanBadge(text: '2'),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(width: 40),
|
||||
const Icon(
|
||||
DidvanIcons.check_double_light,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const DidvanText(
|
||||
'فورت فورت،تموم شد؟ خیلی تاثیرگذار بود.',
|
||||
maxLines: 1,
|
||||
),
|
||||
DidvanText(
|
||||
'15 دقیقه پیش',
|
||||
style: Theme.of(context).textTheme.caption,
|
||||
color: Theme.of(context).colorScheme.caption,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const DidvanDivider(),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import 'package:didvan/providers/core_provider.dart';
|
||||
|
||||
class ChatListState extends CoreProvier {}
|
||||
|
|
@ -33,7 +33,7 @@ class Profile extends StatelessWidget {
|
|||
MenuItem(
|
||||
title: 'پیامها',
|
||||
icon: DidvanIcons.message_regular,
|
||||
onTap: () => {},
|
||||
onTap: () => Navigator.of(context).pushNamed(Routes.chatList),
|
||||
),
|
||||
const DidvanDivider(),
|
||||
MenuItem(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import 'package:didvan/pages/home/home.dart';
|
|||
import 'package:didvan/pages/home/home_state.dart';
|
||||
import 'package:didvan/pages/home/news/news_details/news_details.dart';
|
||||
import 'package:didvan/pages/home/news/news_details/news_details_state.dart';
|
||||
import 'package:didvan/pages/home/profile/chat_list/chat_list.dart';
|
||||
import 'package:didvan/pages/home/profile/chat_list/chat_list_state.dart';
|
||||
import 'package:didvan/pages/home/profile/edit_profile/edit_profile.dart';
|
||||
import 'package:didvan/pages/home/profile/settings/settings.dart';
|
||||
import 'package:didvan/pages/home/profile/settings/settings_state.dart';
|
||||
|
|
@ -64,6 +66,14 @@ class RouteGenerator {
|
|||
child: const NewsDetails(),
|
||||
),
|
||||
);
|
||||
case Routes.chatList:
|
||||
return _createRoute(
|
||||
ChangeNotifierProvider<ChatListState>(
|
||||
create: (context) => ChatListState(),
|
||||
child: const ChatList(),
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return _errorRoute();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ class Routes {
|
|||
static const String settings = '/settings';
|
||||
static const String radarDetails = '/radar-details';
|
||||
static const String newsDetails = '/news-details';
|
||||
static const String chatList = '/chat-list';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,23 +20,29 @@ class DidvanAppBar extends StatelessWidget {
|
|||
icon: const Icon(Icons.arrow_back),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (appBarData.title != null)
|
||||
DidvanText(
|
||||
appBarData.title!,
|
||||
style: Theme.of(context).textTheme.headline3,
|
||||
color: Theme.of(context).colorScheme.title,
|
||||
),
|
||||
if (appBarData.subtitle != null)
|
||||
DidvanText(
|
||||
appBarData.title!,
|
||||
style: Theme.of(context).textTheme.overline,
|
||||
color: Theme.of(context).colorScheme.caption,
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (appBarData.title != null)
|
||||
DidvanText(
|
||||
appBarData.title!,
|
||||
style: Theme.of(context).textTheme.headline3,
|
||||
color: Theme.of(context).colorScheme.title,
|
||||
),
|
||||
if (appBarData.subtitle != null)
|
||||
DidvanText(
|
||||
appBarData.title!,
|
||||
style: Theme.of(context).textTheme.overline,
|
||||
color: Theme.of(context).colorScheme.caption,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (appBarData.trailing != null) appBarData.trailing!,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
import 'package:didvan/widgets/didvan/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DidvanBadge extends StatelessWidget {
|
||||
final String text;
|
||||
const DidvanBadge({
|
||||
Key? key,
|
||||
required this.text,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 24,
|
||||
width: 24,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: DidvanText(
|
||||
text,
|
||||
isEnglishFont: true,
|
||||
style: Theme.of(context).textTheme.overline,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ class DidvanText extends StatelessWidget {
|
|||
final double? fontSize;
|
||||
final TextAlign textAlign;
|
||||
final int? maxLines;
|
||||
final bool isEnglishFont;
|
||||
|
||||
const DidvanText(
|
||||
this.text, {
|
||||
|
|
@ -18,17 +19,18 @@ class DidvanText extends StatelessWidget {
|
|||
this.fontWeight,
|
||||
this.textAlign = TextAlign.right,
|
||||
this.maxLines,
|
||||
this.isEnglishFont = false,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(
|
||||
text,
|
||||
style: (style ?? Theme.of(context).textTheme.bodyText2)!.copyWith(
|
||||
style: ((style ?? Theme.of(context).textTheme.bodyText2)!.copyWith(
|
||||
color: color,
|
||||
fontWeight: fontWeight,
|
||||
fontSize: fontSize,
|
||||
),
|
||||
)).copyWith(fontFamily: isEnglishFont ? 'Dana' : null),
|
||||
textAlign: textAlign,
|
||||
maxLines: maxLines,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue