diff --git a/flutter/lib/pages/channel_list/channel_list_item.dart b/flutter/lib/pages/channel_list/channel_list_item.dart index cd02c22..76c16c8 100644 --- a/flutter/lib/pages/channel_list/channel_list_item.dart +++ b/flutter/lib/pages/channel_list/channel_list_item.dart @@ -62,7 +62,7 @@ class _ChannelListItemState extends State { @override Widget build(BuildContext context) { - final dateFormat = context.select((v) => v.dateFormat).dateFormat(); + final dateFormat = context.select((v) => v.dateFormat).dateOnlyFormat(); return Card.filled( margin: EdgeInsets.fromLTRB(0, 4, 0, 4), diff --git a/flutter/lib/pages/client_list/client_list_item.dart b/flutter/lib/pages/client_list/client_list_item.dart index 78b0ba3..e1002f0 100644 --- a/flutter/lib/pages/client_list/client_list_item.dart +++ b/flutter/lib/pages/client_list/client_list_item.dart @@ -19,7 +19,7 @@ class ClientListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final dateFormat = context.select((v) => v.dateFormat).dateFormat(); + final dateFormat = context.select((v) => v.dateFormat).dateOnlyFormat(); return Card.filled( margin: EdgeInsets.fromLTRB(0, 4, 0, 4), diff --git a/flutter/lib/pages/keytoken_list/keytoken_list_item.dart b/flutter/lib/pages/keytoken_list/keytoken_list_item.dart index fdefe60..f3f2b0b 100644 --- a/flutter/lib/pages/keytoken_list/keytoken_list_item.dart +++ b/flutter/lib/pages/keytoken_list/keytoken_list_item.dart @@ -24,7 +24,7 @@ class KeyTokenListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final dateFormat = context.select((v) => v.dateFormat).dateFormat(); + final dateFormat = context.select((v) => v.dateFormat).dateOnlyFormat(); return Card.filled( margin: EdgeInsets.fromLTRB(0, 4, 0, 4), diff --git a/flutter/lib/pages/message_view/message_view.dart b/flutter/lib/pages/message_view/message_view.dart index 8c8200b..7a23cf1 100644 --- a/flutter/lib/pages/message_view/message_view.dart +++ b/flutter/lib/pages/message_view/message_view.dart @@ -202,14 +202,14 @@ class _MessageViewPageState extends State { icon: FontAwesomeIcons.solidUser, title: 'User', values: [user?.userID ?? message.senderUserID, user?.username ?? ''], - mainAction: () => FilteredMessageViewPage(title: user?.username ?? message.senderUserID, filter: MessageFilter(senderUserID: [message.senderUserID])), + mainAction: () => Navi.push(context, () => FilteredMessageViewPage(title: user?.username ?? message.senderUserID, filter: MessageFilter(senderUserID: [message.senderUserID]))), ), UI.metaCard( context: context, icon: FontAwesomeIcons.solidBolt, title: 'Priority', values: [_prettyPrintPriority(message.priority)], - mainAction: () => FilteredMessageViewPage(title: "Priority ${message.priority}", filter: MessageFilter(priority: [message.priority])), + mainAction: () => Navi.push(context, () => FilteredMessageViewPage(title: "Priority ${message.priority}", filter: MessageFilter(priority: [message.priority]))), ), if (message.senderUserID == userAccUserID) UI.button(text: "Delete Message", onPressed: () {/*TODO*/}, color: Colors.red[900]), ], diff --git a/flutter/lib/pages/sender_list/sender_list_item.dart b/flutter/lib/pages/sender_list/sender_list_item.dart index 685ff2f..151a0bd 100644 --- a/flutter/lib/pages/sender_list/sender_list_item.dart +++ b/flutter/lib/pages/sender_list/sender_list_item.dart @@ -22,7 +22,7 @@ class SenderListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final dateFormat = context.select((v) => v.dateFormat).dateFormat(); + final dateFormat = context.select((v) => v.dateFormat).dateOnlyFormat(); return Card.filled( margin: EdgeInsets.fromLTRB(0, 4, 0, 4), diff --git a/flutter/lib/pages/subscription_view/subscription_view.dart b/flutter/lib/pages/subscription_view/subscription_view.dart index e81465d..87f7afc 100644 --- a/flutter/lib/pages/subscription_view/subscription_view.dart +++ b/flutter/lib/pages/subscription_view/subscription_view.dart @@ -160,7 +160,7 @@ class _SubscriptionViewPageState extends State { } Widget _buildOwnedSubscriptionView(BuildContext context, Subscription subscription) { - final dateFormat = context.select((v) => v.dateFormat).dateFormat(); + final dateFormat = context.select((v) => v.dateFormat).dateOnlyFormat(); return SingleChildScrollView( child: Padding( @@ -193,7 +193,7 @@ class _SubscriptionViewPageState extends State { } Widget _buildIncomingSubscriptionView(BuildContext context, Subscription subscription) { - final dateFormat = context.select((v) => v.dateFormat).dateFormat(); + final dateFormat = context.select((v) => v.dateFormat).dateOnlyFormat(); return SingleChildScrollView( child: Padding( @@ -228,7 +228,7 @@ class _SubscriptionViewPageState extends State { } Widget _buildOutgoingSubscriptionView(BuildContext context, Subscription subscription) { - final dateFormat = context.select((v) => v.dateFormat).dateFormat(); + final dateFormat = context.select((v) => v.dateFormat).dateOnlyFormat(); return SingleChildScrollView( child: Padding( diff --git a/flutter/lib/state/app_settings.dart b/flutter/lib/state/app_settings.dart index b3566eb..d9fe283 100644 --- a/flutter/lib/state/app_settings.dart +++ b/flutter/lib/state/app_settings.dart @@ -30,6 +30,17 @@ enum AppSettingsDateFormat { } } + DateFormat dateOnlyFormat() { + switch (this) { + case AppSettingsDateFormat.ISO: + return DateFormat('yyyy-MM-dd'); + case AppSettingsDateFormat.German: + return DateFormat('dd.MM.yyyy'); + case AppSettingsDateFormat.US: + return DateFormat('MM/dd/yyyy'); + } + } + static AppSettingsDateFormat? parse(String? string) { if (string == null) return null; return values.firstWhere((e) => e.key == string, orElse: null);