From ad7aaa5c24d5eff253eaa0acd681965d316cb70e Mon Sep 17 00:00:00 2001 From: zoe Date: Mon, 26 Sep 2022 14:08:39 +0200 Subject: [PATCH] fix all the 3d effects by removing them --- lib/dialogues/makepost.dart | 8 ++---- lib/dialogues/search.dart | 2 +- lib/themes/themes.dart | 50 ++++++++++++++++++++++++++++++++++--- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/lib/dialogues/makepost.dart b/lib/dialogues/makepost.dart index 16ff73e..ba39586 100644 --- a/lib/dialogues/makepost.dart +++ b/lib/dialogues/makepost.dart @@ -292,6 +292,7 @@ class _MakePostState extends State { ), ]; c.addAll([ + // content warnings TextFormField( style: Theme.of(context).textTheme.bodyMedium, initialValue: spoilerText, @@ -315,6 +316,7 @@ class _MakePostState extends State { SizedBox( height: MediaQuery.of(context).size.height * 0.6, child: TextFormField( + autofocus: true, initialValue: replyAts, style: Theme.of(context).textTheme.bodyMedium, maxLines: null, @@ -394,12 +396,6 @@ class _MakePostState extends State { contentPadding: const EdgeInsets.all(24), title: Column( children: [ - SelectableText( - textAlign: TextAlign.center, - widget.inReplyTo == null - ? "make-post".i18n() - : "make-reply".i18n(), - style: Theme.of(context).textTheme.displayMedium), if (status != null) SelectableText(status!), if (sending) const LinearProgressIndicator(), ], diff --git a/lib/dialogues/search.dart b/lib/dialogues/search.dart index 67d19fd..d8fca7a 100644 --- a/lib/dialogues/search.dart +++ b/lib/dialogues/search.dart @@ -71,7 +71,7 @@ class _SearchDialogueState extends State { })), decoration: InputDecoration( prefixIcon: Icon( - color: Theme.of(context).colorScheme.secondary, + color: Theme.of(context).colorScheme.primary, Icons.search, ))), if (searched < global.settings!.identities.length && diff --git a/lib/themes/themes.dart b/lib/themes/themes.dart index e0e2350..8228e8d 100644 --- a/lib/themes/themes.dart +++ b/lib/themes/themes.dart @@ -7,6 +7,16 @@ import 'fourth_website.dart' as color_fourth; import 'second.dart' as color_second; import 'first.dart' as color_first; +bool checkActive(Set states) { + return states.intersection({ + MaterialState.focused, + MaterialState.hovered, + MaterialState.pressed + }).isNotEmpty; +} + +const defaultRadius = Radius.circular(8); + // color schemes to pick from can be added here // there is a class to create these final available = [ @@ -23,11 +33,12 @@ final available = [ ThemeData getTheme(CustomColors colors) { return ThemeData( + applyElevationOverlayColor: false, floatingActionButtonTheme: FloatingActionButtonThemeData( hoverColor: colors.colorScheme.onSurface, elevation: 0, enableFeedback: false, - hoverElevation: 24, + hoverElevation: 0, ), fontFamily: 'Atkinson', textTheme: TextTheme( @@ -77,16 +88,32 @@ ThemeData getTheme(CustomColors colors) { ), elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( + shadowColor: MaterialStateProperty.all(Colors.transparent), + shape: MaterialStateProperty.resolveWith((states) { + if (checkActive(states)) { + return RoundedRectangleBorder( + borderRadius: const BorderRadius.all(defaultRadius), + side: BorderSide(color: colors.colorScheme.primary), + ); + } + return const RoundedRectangleBorder( + borderRadius: BorderRadius.all(defaultRadius)); + }), + elevation: MaterialStateProperty.all(0), foregroundColor: MaterialStateProperty.resolveWith((states) { if (states.contains(MaterialState.disabled)) { return colors.colorScheme.surface; } + if (checkActive(states)) return colors.colorScheme.primary; + return null; }), backgroundColor: MaterialStateProperty.resolveWith((states) { if (states.contains(MaterialState.disabled)) return colors.hintColor; + if (checkActive(states)) return colors.colorScheme.onPrimary; return null; }), + overlayColor: MaterialStateProperty.all(Colors.transparent), textStyle: MaterialStateProperty.resolveWith((states) => const TextStyle( fontSize: 18, @@ -112,6 +139,18 @@ ThemeData getTheme(CustomColors colors) { ), textButtonTheme: TextButtonThemeData( style: ButtonStyle( + elevation: MaterialStateProperty.all(0), + shape: MaterialStateProperty.all(const RoundedRectangleBorder( + borderRadius: BorderRadius.all(defaultRadius))), + shadowColor: MaterialStateProperty.all(Colors.transparent), + backgroundColor: MaterialStateProperty.resolveWith((states) { + if (checkActive(states)) return colors.colorScheme.primary; + return null; + }), + foregroundColor: MaterialStateProperty.resolveWith((states) { + if (checkActive(states)) return colors.colorScheme.onPrimary; + return null; + }), textStyle: MaterialStateProperty.all( const TextStyle(fontSize: 18), ), @@ -129,6 +168,7 @@ ThemeData getTheme(CustomColors colors) { colorScheme: colors.colorScheme, errorColor: colors.colorScheme.error, bottomAppBarTheme: BottomAppBarTheme( + elevation: 0, color: colors.colorScheme.surface, ), navigationBarTheme: NavigationBarThemeData( @@ -162,12 +202,16 @@ ThemeData getTheme(CustomColors colors) { fontWeight: FontWeight.w700, ), decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(8)), + borderRadius: const BorderRadius.all(defaultRadius), color: colors.colorScheme.primary, ), ), canvasColor: colors.colorScheme.surface, - dialogBackgroundColor: colors.colorScheme.surface, + dialogTheme: DialogTheme( + elevation: 0, + backgroundColor: colors.colorScheme.surface, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(defaultRadius))), selectedRowColor: colors.colorScheme.background, textSelectionTheme: TextSelectionThemeData(selectionColor: colors.hintColor),