improve dateFormat a bit, and fix some buttons
This commit is contained in:
parent
b91ddc172d
commit
d5e9c6ecc3
@ -62,7 +62,7 @@ class _ChannelListItemState extends State<ChannelListItem> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateOnlyFormat();
|
||||||
|
|
||||||
return Card.filled(
|
return Card.filled(
|
||||||
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
||||||
|
@ -19,7 +19,7 @@ class ClientListItem extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateOnlyFormat();
|
||||||
|
|
||||||
return Card.filled(
|
return Card.filled(
|
||||||
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
||||||
|
@ -24,7 +24,7 @@ class KeyTokenListItem extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateOnlyFormat();
|
||||||
|
|
||||||
return Card.filled(
|
return Card.filled(
|
||||||
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
||||||
|
@ -202,14 +202,14 @@ class _MessageViewPageState extends State<MessageViewPage> {
|
|||||||
icon: FontAwesomeIcons.solidUser,
|
icon: FontAwesomeIcons.solidUser,
|
||||||
title: 'User',
|
title: 'User',
|
||||||
values: [user?.userID ?? message.senderUserID, user?.username ?? ''],
|
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(
|
UI.metaCard(
|
||||||
context: context,
|
context: context,
|
||||||
icon: FontAwesomeIcons.solidBolt,
|
icon: FontAwesomeIcons.solidBolt,
|
||||||
title: 'Priority',
|
title: 'Priority',
|
||||||
values: [_prettyPrintPriority(message.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]),
|
if (message.senderUserID == userAccUserID) UI.button(text: "Delete Message", onPressed: () {/*TODO*/}, color: Colors.red[900]),
|
||||||
],
|
],
|
||||||
|
@ -22,7 +22,7 @@ class SenderListItem extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateOnlyFormat();
|
||||||
|
|
||||||
return Card.filled(
|
return Card.filled(
|
||||||
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
margin: EdgeInsets.fromLTRB(0, 4, 0, 4),
|
||||||
|
@ -160,7 +160,7 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildOwnedSubscriptionView(BuildContext context, Subscription subscription) {
|
Widget _buildOwnedSubscriptionView(BuildContext context, Subscription subscription) {
|
||||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateOnlyFormat();
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -193,7 +193,7 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIncomingSubscriptionView(BuildContext context, Subscription subscription) {
|
Widget _buildIncomingSubscriptionView(BuildContext context, Subscription subscription) {
|
||||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateOnlyFormat();
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -228,7 +228,7 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildOutgoingSubscriptionView(BuildContext context, Subscription subscription) {
|
Widget _buildOutgoingSubscriptionView(BuildContext context, Subscription subscription) {
|
||||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateOnlyFormat();
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
@ -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) {
|
static AppSettingsDateFormat? parse(String? string) {
|
||||||
if (string == null) return null;
|
if (string == null) return null;
|
||||||
return values.firstWhere((e) => e.key == string, orElse: null);
|
return values.firstWhere((e) => e.key == string, orElse: null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user