mirror of
https://github.com/Myzel394/quid_faciam_hodie.git
synced 2025-06-19 15:45:26 +02:00
improvements & bugfixes
This commit is contained in:
parent
c10cdb254f
commit
f62d0f10b9
@ -52,9 +52,6 @@ class _MyAppState extends State<MyApp> {
|
|||||||
darkTheme: DARK_THEME_MATERIAL,
|
darkTheme: DARK_THEME_MATERIAL,
|
||||||
themeMode: ThemeMode.system,
|
themeMode: ThemeMode.system,
|
||||||
),
|
),
|
||||||
cupertino: (_, __) => CupertinoAppData(
|
|
||||||
theme: LIGHT_THEME_CUPERTINO,
|
|
||||||
),
|
|
||||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
supportedLocales: AppLocalizations.supportedLocales,
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
routes: {
|
routes: {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
import 'package:gallery_saver/gallery_saver.dart';
|
import 'package:gallery_saver/gallery_saver.dart';
|
||||||
import 'package:quid_faciam_hodie/constants/spacing.dart';
|
import 'package:quid_faciam_hodie/constants/spacing.dart';
|
||||||
import 'package:quid_faciam_hodie/enums.dart';
|
import 'package:quid_faciam_hodie/enums.dart';
|
||||||
@ -7,6 +9,7 @@ import 'package:quid_faciam_hodie/extensions/snackbar.dart';
|
|||||||
import 'package:quid_faciam_hodie/foreign_types/memory.dart';
|
import 'package:quid_faciam_hodie/foreign_types/memory.dart';
|
||||||
import 'package:quid_faciam_hodie/managers/file_manager.dart';
|
import 'package:quid_faciam_hodie/managers/file_manager.dart';
|
||||||
import 'package:quid_faciam_hodie/utils/loadable.dart';
|
import 'package:quid_faciam_hodie/utils/loadable.dart';
|
||||||
|
import 'package:quid_faciam_hodie/utils/theme.dart';
|
||||||
import 'package:quid_faciam_hodie/widgets/modal_sheet.dart';
|
import 'package:quid_faciam_hodie/widgets/modal_sheet.dart';
|
||||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||||
|
|
||||||
@ -94,14 +97,19 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildLoadingIndicator() {
|
Widget buildLoadingIndicator() {
|
||||||
final theme = Theme.of(context);
|
final size = platformThemeData(
|
||||||
|
context,
|
||||||
|
material: (data) => data.textTheme.titleLarge!.fontSize,
|
||||||
|
cupertino: (data) => data.textTheme.textStyle.fontSize,
|
||||||
|
);
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox.square(
|
||||||
width: theme.textTheme.titleLarge!.fontSize,
|
dimension: size,
|
||||||
height: theme.textTheme.titleLarge!.fontSize,
|
child: PlatformCircularProgressIndicator(
|
||||||
child: CircularProgressIndicator(
|
material: (_, __) => MaterialProgressIndicatorData(
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
color: theme.textTheme.bodyText1!.color,
|
color: Theme.of(context).textTheme.bodyText1!.color,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -109,19 +117,30 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localizations = AppLocalizations.of(context)!;
|
final localizations = AppLocalizations.of(context)!;
|
||||||
final theme = Theme.of(context);
|
|
||||||
|
|
||||||
return ModalSheet(
|
return ModalSheet(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
localizations.memorySheetTitle,
|
localizations.memorySheetTitle,
|
||||||
style: theme.textTheme.headline1,
|
style: getTitleTextStyle(context),
|
||||||
),
|
),
|
||||||
const SizedBox(height: MEDIUM_SPACE),
|
const SizedBox(height: MEDIUM_SPACE),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.download),
|
leading: PlatformWidget(
|
||||||
title: Text(localizations.memorySheetDownloadMemory),
|
cupertino: (_, __) => Icon(
|
||||||
|
CupertinoIcons.down_arrow,
|
||||||
|
color: getBodyTextColor(context),
|
||||||
|
),
|
||||||
|
material: (_, __) => Icon(
|
||||||
|
Icons.download,
|
||||||
|
color: getBodyTextColor(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
localizations.memorySheetDownloadMemory,
|
||||||
|
style: getBodyTextTextStyle(context),
|
||||||
|
),
|
||||||
enabled: !getIsLoadingSpecificID('download'),
|
enabled: !getIsLoadingSpecificID('download'),
|
||||||
onTap: getIsLoadingSpecificID('download')
|
onTap: getIsLoadingSpecificID('download')
|
||||||
? null
|
? null
|
||||||
@ -131,13 +150,15 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(widget.memory.isPublic
|
leading: Icon(
|
||||||
? Icons.public_off_rounded
|
widget.memory.isPublic ? Icons.public_off_rounded : Icons.public,
|
||||||
: Icons.public_rounded),
|
color: getBodyTextColor(context),
|
||||||
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
widget.memory.isPublic
|
widget.memory.isPublic
|
||||||
? localizations.memorySheetUpdateMemoryMakePrivate
|
? localizations.memorySheetUpdateMemoryMakePrivate
|
||||||
: localizations.memorySheetUpdateMemoryMakePublic,
|
: localizations.memorySheetUpdateMemoryMakePublic,
|
||||||
|
style: getBodyTextTextStyle(context),
|
||||||
),
|
),
|
||||||
enabled: !getIsLoadingSpecificID('public'),
|
enabled: !getIsLoadingSpecificID('public'),
|
||||||
onTap: getIsLoadingSpecificID('public')
|
onTap: getIsLoadingSpecificID('public')
|
||||||
@ -148,8 +169,14 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.delete_forever_sharp),
|
leading: Icon(
|
||||||
title: Text(localizations.memorySheetDeleteMemory),
|
context.platformIcons.delete,
|
||||||
|
color: getBodyTextColor(context),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
localizations.memorySheetDeleteMemory,
|
||||||
|
style: getBodyTextTextStyle(context),
|
||||||
|
),
|
||||||
enabled: !getIsLoadingSpecificID('delete'),
|
enabled: !getIsLoadingSpecificID('delete'),
|
||||||
onTap: getIsLoadingSpecificID('delete')
|
onTap: getIsLoadingSpecificID('delete')
|
||||||
? null
|
? null
|
||||||
|
26
lib/utils/theme.dart
Normal file
26
lib/utils/theme.dart
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
|
|
||||||
|
TextStyle getBodyTextTextStyle(final BuildContext context) => platformThemeData(
|
||||||
|
context,
|
||||||
|
material: (data) => data.textTheme.bodyText1!,
|
||||||
|
cupertino: (data) => data.textTheme.textStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
Color getBodyTextColor(final BuildContext context) => platformThemeData(
|
||||||
|
context,
|
||||||
|
material: (data) => data.textTheme.bodyText1!.color!,
|
||||||
|
cupertino: (data) => data.textTheme.textStyle.color!,
|
||||||
|
);
|
||||||
|
|
||||||
|
TextStyle getTitleTextStyle(final BuildContext context) => platformThemeData(
|
||||||
|
context,
|
||||||
|
material: (data) => data.textTheme.headline1!,
|
||||||
|
cupertino: (data) => data.textTheme.navLargeTitleTextStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
TextStyle getSubTitleTextStyle(final BuildContext context) => platformThemeData(
|
||||||
|
context,
|
||||||
|
material: (data) => data.textTheme.subtitle1!,
|
||||||
|
cupertino: (data) => data.textTheme.navTitleTextStyle,
|
||||||
|
);
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
import 'package:quid_faciam_hodie/constants/spacing.dart';
|
import 'package:quid_faciam_hodie/constants/spacing.dart';
|
||||||
|
|
||||||
class ModalSheet extends StatelessWidget {
|
class ModalSheet extends StatelessWidget {
|
||||||
@ -11,8 +12,6 @@ class ModalSheet extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
|
||||||
|
|
||||||
return Wrap(
|
return Wrap(
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -24,8 +23,13 @@ class ModalSheet extends StatelessWidget {
|
|||||||
topLeft: Radius.circular(LARGE_SPACE),
|
topLeft: Radius.circular(LARGE_SPACE),
|
||||||
topRight: Radius.circular(LARGE_SPACE),
|
topRight: Radius.circular(LARGE_SPACE),
|
||||||
),
|
),
|
||||||
color: theme.bottomSheetTheme.modalBackgroundColor ??
|
color: platformThemeData(
|
||||||
theme.bottomAppBarColor,
|
context,
|
||||||
|
material: (data) =>
|
||||||
|
data.bottomSheetTheme.modalBackgroundColor ??
|
||||||
|
data.bottomAppBarColor,
|
||||||
|
cupertino: (data) => data.barBackgroundColor,
|
||||||
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(MEDIUM_SPACE),
|
padding: const EdgeInsets.all(MEDIUM_SPACE),
|
||||||
child: child,
|
child: child,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user