Implement settings
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:simplecloudnotifier/models/user.dart';
|
||||
import 'package:simplecloudnotifier/pages/channel_view/channel_view.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/state/app_bar_state.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/types/immediate_future.dart';
|
||||
import 'package:simplecloudnotifier/utils/dialogs.dart';
|
||||
@@ -40,8 +41,6 @@ enum EditState { none, editing, saving }
|
||||
enum SubscriptionViewPageInitState { loading, okay, error }
|
||||
|
||||
class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
static final _dateFormat = DateFormat('yyyy-MM-dd HH:mm'); //TODO setting
|
||||
|
||||
ImmediateFuture<UserPreview> _futureChannelOwner = ImmediateFuture.ofPending();
|
||||
ImmediateFuture<UserPreview> _futureSubscriber = ImmediateFuture.ofPending();
|
||||
ImmediateFuture<ChannelPreview> _futureChannel = ImmediateFuture.ofPending();
|
||||
@@ -161,6 +160,8 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
}
|
||||
|
||||
Widget _buildOwnedSubscriptionView(BuildContext context, Subscription subscription) {
|
||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
|
||||
@@ -181,7 +182,7 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.clock,
|
||||
title: 'Created',
|
||||
values: [_SubscriptionViewPageState._dateFormat.format(DateTime.parse(subscription.timestampCreated).toLocal())],
|
||||
values: [dateFormat.format(DateTime.parse(subscription.timestampCreated).toLocal())],
|
||||
),
|
||||
_buildStatusCard(context),
|
||||
UI.button(text: "Unsubscribe", onPressed: _unsubscribe, tonal: true),
|
||||
@@ -192,6 +193,8 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
}
|
||||
|
||||
Widget _buildIncomingSubscriptionView(BuildContext context, Subscription subscription) {
|
||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
|
||||
@@ -212,7 +215,7 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.clock,
|
||||
title: 'Created',
|
||||
values: [_SubscriptionViewPageState._dateFormat.format(DateTime.parse(subscription.timestampCreated).toLocal())],
|
||||
values: [dateFormat.format(DateTime.parse(subscription.timestampCreated).toLocal())],
|
||||
),
|
||||
_buildStatusCard(context),
|
||||
if (subscription.confirmed) UI.button(text: "Revoke subscription", onPressed: _unsubscribe, color: Colors.red),
|
||||
@@ -225,6 +228,8 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
}
|
||||
|
||||
Widget _buildOutgoingSubscriptionView(BuildContext context, Subscription subscription) {
|
||||
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
|
||||
@@ -245,7 +250,7 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.clock,
|
||||
title: 'Created',
|
||||
values: [_SubscriptionViewPageState._dateFormat.format(DateTime.parse(subscription.timestampCreated).toLocal())],
|
||||
values: [dateFormat.format(DateTime.parse(subscription.timestampCreated).toLocal())],
|
||||
),
|
||||
_buildStatusCard(context),
|
||||
if (subscription.confirmed && subscription.active) UI.button(text: "Deactivate subscription", onPressed: _deactivate, tonal: true),
|
||||
|
||||
Reference in New Issue
Block a user