From 990259830440d043bb00be0bf81757644cb81f69 Mon Sep 17 00:00:00 2001 From: den0206 Date: Sat, 13 May 2023 14:51:41 +0900 Subject: [PATCH 1/2] remove accentColor --- example/lib/accessibility/neumorphic_accessibility.dart | 7 +++---- example/lib/playground/neumorphic_playground.dart | 8 ++++---- example/lib/playground/text_playground.dart | 9 ++++----- example/lib/sample_neumorphic_playground.dart | 6 ++---- lib/src/widget/app_bar.dart | 7 ++----- 5 files changed, 15 insertions(+), 22 deletions(-) diff --git a/example/lib/accessibility/neumorphic_accessibility.dart b/example/lib/accessibility/neumorphic_accessibility.dart index 15f6223a..b8cbe581 100644 --- a/example/lib/accessibility/neumorphic_accessibility.dart +++ b/example/lib/accessibility/neumorphic_accessibility.dart @@ -1,5 +1,4 @@ import 'package:example/lib/color_selector.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class NeumorphicAccessibility extends StatefulWidget { @@ -71,7 +70,7 @@ class __PageState extends State<_Page> { child: RaisedButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12)), - color: Theme.of(context).accentColor, + color: Theme.of(context).colorScheme.secondary, child: Text( "back", style: TextStyle(color: Colors.white), @@ -104,7 +103,7 @@ class __PageState extends State<_Page> { int selectedConfiguratorIndex = 0; Widget _configurators() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color textActiveColor = Colors.white; @@ -513,7 +512,7 @@ class __PageState extends State<_Page> { } Widget shapeWidget() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color iconActiveColor = Colors.white; diff --git a/example/lib/playground/neumorphic_playground.dart b/example/lib/playground/neumorphic_playground.dart index eb52041c..94846eba 100644 --- a/example/lib/playground/neumorphic_playground.dart +++ b/example/lib/playground/neumorphic_playground.dart @@ -71,7 +71,7 @@ class __PageState extends State<_Page> { child: RaisedButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12)), - color: Theme.of(context).accentColor, + color: Theme.of(context).colorScheme.secondary, child: Text( "back", style: TextStyle(color: Colors.white), @@ -102,7 +102,7 @@ class __PageState extends State<_Page> { int selectedConfiguratorIndex = 0; Widget _configurators() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color textActiveColor = Colors.white; @@ -622,7 +622,7 @@ class __PageState extends State<_Page> { } Widget boxshapeWidget() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color textActiveColor = Colors.white; @@ -756,7 +756,7 @@ class __PageState extends State<_Page> { } Widget shapeWidget() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color iconActiveColor = Colors.white; diff --git a/example/lib/playground/text_playground.dart b/example/lib/playground/text_playground.dart index f1a547cd..dda81e4b 100644 --- a/example/lib/playground/text_playground.dart +++ b/example/lib/playground/text_playground.dart @@ -1,5 +1,4 @@ import 'package:example/lib/color_selector.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class NeumorphicTextPlayground extends StatefulWidget { @@ -92,7 +91,7 @@ class __PageState extends State<_Page> { child: RaisedButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12)), - color: Theme.of(context).accentColor, + color: Theme.of(context).colorScheme.secondary, child: Text( "back", style: TextStyle(color: Colors.white), @@ -125,7 +124,7 @@ class __PageState extends State<_Page> { int selectedConfiguratorIndex = 0; Widget _configurators() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color textActiveColor = Colors.white; @@ -238,7 +237,7 @@ class __PageState extends State<_Page> { } Widget shapeWidget() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color iconActiveColor = Colors.white; @@ -444,7 +443,7 @@ class __PageState extends State<_Page> { } FontWeight _fontWeight() { - switch ((this.fontWeight / 100).toInt()) { + switch (this.fontWeight ~/ 100) { case 1: return FontWeight.w100; case 2: diff --git a/example/lib/sample_neumorphic_playground.dart b/example/lib/sample_neumorphic_playground.dart index afb309e7..d5de1e45 100644 --- a/example/lib/sample_neumorphic_playground.dart +++ b/example/lib/sample_neumorphic_playground.dart @@ -1,5 +1,3 @@ -import 'package:example/lib/color_selector.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; void main() => runApp(NeumorphicPlayground()); @@ -85,7 +83,7 @@ class __PageState extends State<_Page> { } Widget _configurators() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color textActiveColor = Colors.white; @@ -246,7 +244,7 @@ class __PageState extends State<_Page> { } Widget shapeWidget() { - final Color buttonActiveColor = Theme.of(context).accentColor; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; final Color buttonInnactiveColor = Colors.white; final Color iconActiveColor = Colors.white; diff --git a/lib/src/widget/app_bar.dart b/lib/src/widget/app_bar.dart index 75768744..2f4268fa 100644 --- a/lib/src/widget/app_bar.dart +++ b/lib/src/widget/app_bar.dart @@ -1,7 +1,4 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; -import 'package:flutter_neumorphic/src/widget/back_button.dart'; class NeumorphicAppBar extends StatefulWidget implements PreferredSizeWidget { static const toolbarHeight = kToolbarHeight + 16 * 2; @@ -180,8 +177,8 @@ class NeumorphicAppBarState extends State { if (title != null) { final AppBarTheme appBarTheme = AppBarTheme.of(context); title = DefaultTextStyle( - style: (appBarTheme.textTheme?.headline5 ?? - Theme.of(context).textTheme.headline5!) + style: (appBarTheme.titleTextStyle ?? + Theme.of(context).textTheme.titleMedium!) .merge(widget.textStyle ?? nTheme?.current?.appBarTheme.textStyle), softWrap: false, overflow: TextOverflow.ellipsis, From ad0b48874f52a9da1efb3ac60b1c519a7f57f427 Mon Sep 17 00:00:00 2001 From: den0206 Date: Sat, 13 May 2023 14:52:03 +0900 Subject: [PATCH 2/2] remove textTheme --- lib/src/widget/app.dart | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/src/widget/app.dart b/lib/src/widget/app.dart index 70948b8d..72b88b2b 100644 --- a/lib/src/widget/app.dart +++ b/lib/src/widget/app.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class NeumorphicApp extends StatelessWidget { @@ -86,13 +85,8 @@ class NeumorphicApp extends StatelessWidget { return ThemeData( primaryColor: theme.accentColor, - accentColor: theme.variantColor, iconTheme: theme.iconTheme, brightness: ThemeData.estimateBrightnessForColor(theme.baseColor), - primaryColorBrightness: - ThemeData.estimateBrightnessForColor(theme.accentColor), - accentColorBrightness: - ThemeData.estimateBrightnessForColor(theme.variantColor), textTheme: theme.textTheme, scaffoldBackgroundColor: theme.baseColor, );