diff --git a/example/android/.gitignore b/example/android/.gitignore index bc2100d8..6f568019 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -5,3 +5,9 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 0f6a5e54..0833ecfc 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,24 +26,31 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' } - lintOptions { - disable 'InvalidPackage' + sourceSets { + main.java.srcDirs += 'src/main/kotlin' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" - minSdkVersion 16 - targetSdkVersion 28 + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -61,7 +68,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' } diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index c208884f..45d523a2 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,7 @@ - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index ca1d66b5..3f41384d 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,25 +1,25 @@ - - - - - - + + diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt index 1656503f..df49ce4e 100644 --- a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -1,12 +1,7 @@ package com.example.example -import androidx.annotation.NonNull; import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity: FlutterActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } + val myString = "adding this one cuz codefactor does not allow an empty function!" } diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..06952be7 --- /dev/null +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml index 00fa4417..cb1ef880 100644 --- a/example/android/app/src/main/res/values/styles.xml +++ b/example/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml index c208884f..45d523a2 100644 --- a/example/android/app/src/profile/AndroidManifest.xml +++ b/example/android/app/src/profile/AndroidManifest.xml @@ -1,6 +1,7 @@ - diff --git a/example/android/build.gradle b/example/android/build.gradle index 3100ad2d..83ae2200 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.6.10' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 38c8d454..94adc3a3 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,4 +1,3 @@ org.gradle.jvmargs=-Xmx1536M -android.enableR8=true android.useAndroidX=true android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 296b146b..cb24abda 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 5a2f14fb..44e62bcf 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/lib/accessibility/neumorphic_accessibility.dart b/example/lib/accessibility/neumorphic_accessibility.dart index 15f6223a..65f282ef 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 { @@ -40,8 +39,8 @@ class __PageState extends State<_Page> { double height = 150.0; double width = 150.0; - Color borderColor; - double borderWidth; + late Color borderColor; + late double borderWidth; static final minWidth = 50.0; static final maxWidth = 200.0; @@ -68,10 +67,12 @@ class __PageState extends State<_Page> { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), - color: Theme.of(context).accentColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: Theme.of(context).colorScheme.secondary, + ), child: Text( "back", style: TextStyle(color: Colors.white), @@ -104,7 +105,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; @@ -124,12 +125,14 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), - color: selectedConfiguratorIndex == 0 - ? buttonActiveColor - : buttonInnactiveColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: selectedConfiguratorIndex == 0 + // ? buttonActiveColor + // : buttonInnactiveColor + ), child: Text( "Style", style: TextStyle( @@ -150,9 +153,14 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: selectedConfiguratorIndex == 1 + // ? buttonActiveColor + // : buttonInnactiveColor + ), child: Text( "Element", style: TextStyle( @@ -161,9 +169,6 @@ class __PageState extends State<_Page> { : textInactiveColor, ), ), - color: selectedConfiguratorIndex == 1 - ? buttonActiveColor - : buttonInnactiveColor, onPressed: () { setState(() { selectedConfiguratorIndex = 1; @@ -176,9 +181,14 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: selectedConfiguratorIndex == 2 + // ? buttonActiveColor + // : buttonInnactiveColor, + ), child: Text( "Border", style: TextStyle( @@ -187,9 +197,6 @@ class __PageState extends State<_Page> { : textInactiveColor, ), ), - color: selectedConfiguratorIndex == 2 - ? buttonActiveColor - : buttonInnactiveColor, onPressed: () { setState(() { selectedConfiguratorIndex = 2; @@ -200,23 +207,20 @@ class __PageState extends State<_Page> { ), ], ), - _configuratorsChild(), + _configuratorsChild()!, ], ), ); } - Widget _configuratorsChild() { + Widget? _configuratorsChild() { switch (selectedConfiguratorIndex) { case 0: return styleCustomizer(); - break; case 1: return elementCustomizer(); - break; case 2: return borderCustomizer(); - break; } return null; } @@ -267,7 +271,7 @@ class __PageState extends State<_Page> { ColorSelector( onColorChanged: (color) { setState(() { - NeumorphicTheme.of(context) + NeumorphicTheme.of(context)! .updateCurrentTheme(NeumorphicThemeData(baseColor: color)); }); }, @@ -325,10 +329,7 @@ class __PageState extends State<_Page> { child: SizedBox( height: height, width: width, - child: Container( - //color: Colors.blue, - child: Center(child: Text("")), - ), + child: Center(child: Text("")), ), ); } @@ -513,7 +514,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; @@ -525,17 +526,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.concave + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.concave; }); }, - color: shape == NeumorphicShape.concave - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/concave.png", color: shape == NeumorphicShape.concave ? iconActiveColor @@ -546,17 +549,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.convex + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.convex; }); }, - color: shape == NeumorphicShape.convex - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/convex.png", color: shape == NeumorphicShape.convex ? iconActiveColor @@ -567,17 +572,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.flat + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.flat; }); }, - color: shape == NeumorphicShape.flat - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/flat.png", color: shape == NeumorphicShape.flat ? iconActiveColor diff --git a/example/lib/lib/Code.dart b/example/lib/lib/Code.dart index 7e02ee7e..a70994f6 100644 --- a/example/lib/lib/Code.dart +++ b/example/lib/lib/Code.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class Code extends StatelessWidget { @@ -22,7 +21,7 @@ class Code extends StatelessWidget { class MyIntWidget extends StatefulWidget { final int value; - MyIntWidget({this.value}); + MyIntWidget({required this.value}); @override _MyIntWidgetState createState() => _MyIntWidgetState(); @@ -30,9 +29,9 @@ class MyIntWidget extends StatefulWidget { class _MyIntWidgetState extends State with TickerProviderStateMixin { - int _value; - AnimationController _controller; - Animation _valueAnimation; + late int _value; + late AnimationController _controller; + late Animation _valueAnimation; @override void initState() { diff --git a/example/lib/lib/ThemeColorSelector.dart b/example/lib/lib/ThemeColorSelector.dart index b9f3fcf4..884b6fcc 100644 --- a/example/lib/lib/ThemeColorSelector.dart +++ b/example/lib/lib/ThemeColorSelector.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'color_selector.dart'; @@ -6,7 +5,7 @@ import 'color_selector.dart'; class ThemeColorSelector extends StatefulWidget { final BuildContext customContext; - ThemeColorSelector({this.customContext}); + ThemeColorSelector({required this.customContext}); @override _ThemeColorSelectorState createState() => _ThemeColorSelectorState(); @@ -19,11 +18,11 @@ class _ThemeColorSelectorState extends State { padding: EdgeInsets.all(4), color: Colors.black, child: ColorSelector( - color: NeumorphicTheme.baseColor(widget.customContext ?? context), + color: NeumorphicTheme.baseColor(widget.customContext), onColorChanged: (color) { setState(() { - NeumorphicTheme.update(widget.customContext ?? context, - (current) => current.copyWith(baseColor: color)); + NeumorphicTheme.update(widget.customContext, + (current) => current!.copyWith(baseColor: color)); }); }, ), diff --git a/example/lib/lib/ThemeConfigurator.dart b/example/lib/lib/ThemeConfigurator.dart index d6f6000e..60fea2dd 100644 --- a/example/lib/lib/ThemeConfigurator.dart +++ b/example/lib/lib/ThemeConfigurator.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'ThemeColorSelector.dart'; @@ -50,7 +49,7 @@ class ThemeConfigurator extends StatelessWidget { class _ThemeConfiguratorDialog extends StatefulWidget { final BuildContext contextContainingTheme; - _ThemeConfiguratorDialog({this.contextContainingTheme}); + _ThemeConfiguratorDialog({required this.contextContainingTheme}); @override _ThemeConfiguratorState createState() => _ThemeConfiguratorState(); @@ -82,12 +81,12 @@ class _ThemeConfiguratorState extends State<_ThemeConfiguratorDialog> { child: Slider( min: Neumorphic.MIN_INTENSITY, //in case of != 0 max: Neumorphic.MAX_INTENSITY, - value: intensity, + value: intensity!, onChanged: (value) { setState(() { NeumorphicTheme.update( widget.contextContainingTheme, - (current) => current.copyWith( + (current) => current!.copyWith( intensity: value, ), ); @@ -119,12 +118,12 @@ class _ThemeConfiguratorState extends State<_ThemeConfiguratorDialog> { child: Slider( min: Neumorphic.MIN_DEPTH, max: Neumorphic.MAX_DEPTH, - value: depth, + value: depth!, onChanged: (value) { setState(() { NeumorphicTheme.update( widget.contextContainingTheme, - (current) => current.copyWith(depth: value), + (current) => current!.copyWith(depth: value), ); }); }, diff --git a/example/lib/lib/back_button.dart b/example/lib/lib/back_button.dart index 6f0b876a..79453357 100644 --- a/example/lib/lib/back_button.dart +++ b/example/lib/lib/back_button.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class NeumorphicBack extends StatelessWidget { diff --git a/example/lib/lib/color_selector.dart b/example/lib/lib/color_selector.dart index 44133300..9dcfef71 100644 --- a/example/lib/lib/color_selector.dart +++ b/example/lib/lib/color_selector.dart @@ -1,7 +1,4 @@ -import 'dart:ui'; - import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_colorpicker/flutter_colorpicker.dart'; @immutable @@ -12,7 +9,10 @@ class ColorSelector extends StatelessWidget { final double width; const ColorSelector( - {this.height = 40, this.width = 40, this.color, this.onColorChanged}); + {this.height = 40, + this.width = 40, + required this.color, + required this.onColorChanged}); @override Widget build(BuildContext context) { @@ -44,12 +44,11 @@ class ColorSelector extends StatelessWidget { child: ColorPicker( pickerColor: color, onColorChanged: this.onColorChanged, - showLabel: true, pickerAreaHeightPercent: 0.8, ), ), actions: [ - FlatButton( + TextButton( child: const Text('Close'), onPressed: () { Navigator.of(context).pop(); diff --git a/example/lib/lib/top_bar.dart b/example/lib/lib/top_bar.dart index a96d23c2..cfeebe12 100644 --- a/example/lib/lib/top_bar.dart +++ b/example/lib/lib/top_bar.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'back_button.dart'; @@ -10,7 +8,7 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget { static const double kToolbarHeight = 110.0; - const TopBar({this.title = "", this.actions}); + const TopBar({this.title = "", required this.actions}); @override Widget build(BuildContext context) { @@ -36,7 +34,7 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget { alignment: Alignment.centerRight, child: Row( mainAxisSize: MainAxisSize.min, - children: actions ?? [], + children: actions, )), ], ), diff --git a/example/lib/main.dart b/example/lib/main.dart index 0ae45ac6..bcd8e943 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,14 +1,15 @@ import 'package:flutter_neumorphic/flutter_neumorphic.dart'; - import 'main_home.dart'; -void main() => runApp(MyApp()); +void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { + const MyApp({super.key}); + // This widget is the root of your application. @override Widget build(BuildContext context) { - return NeumorphicApp( + return const NeumorphicApp( debugShowCheckedModeBanner: false, title: 'Flutter Demo', themeMode: ThemeMode.light, @@ -28,12 +29,13 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatelessWidget { - MyHomePage({Key key}) : super(key: key); + const MyHomePage({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Scaffold( floatingActionButton: NeumorphicFloatingActionButton( - child: Icon(Icons.add, size: 30), + child: const Icon(Icons.add, size: 30), onPressed: () {}, ), backgroundColor: NeumorphicTheme.baseColor(context), @@ -45,7 +47,7 @@ class MyHomePage extends StatelessWidget { onPressed: () { print("onClick"); }, - style: NeumorphicStyle( + style: const NeumorphicStyle( shape: NeumorphicShape.flat, boxShape: NeumorphicBoxShape.circle(), ), @@ -56,9 +58,9 @@ class MyHomePage extends StatelessWidget { ), ), NeumorphicButton( - margin: EdgeInsets.only(top: 12), + margin: const EdgeInsets.only(top: 12), onPressed: () { - NeumorphicTheme.of(context).themeMode = + NeumorphicTheme.of(context)!.themeMode = NeumorphicTheme.isUsingDark(context) ? ThemeMode.light : ThemeMode.dark; @@ -74,7 +76,7 @@ class MyHomePage extends StatelessWidget { style: TextStyle(color: _textColor(context)), )), NeumorphicButton( - margin: EdgeInsets.only(top: 12), + margin: const EdgeInsets.only(top: 12), onPressed: () { Navigator.of(context) .pushReplacement(MaterialPageRoute(builder: (context) { @@ -98,10 +100,10 @@ class MyHomePage extends StatelessWidget { ); } - Color _iconsColor(BuildContext context) { + Color? _iconsColor(BuildContext context) { final theme = NeumorphicTheme.of(context); - if (theme.isUsingDark) { - return theme.current.accentColor; + if (theme!.isUsingDark) { + return theme.current!.accentColor; } else { return null; } diff --git a/example/lib/main_home.dart b/example/lib/main_home.dart index b6d42dfb..9e20b816 100644 --- a/example/lib/main_home.dart +++ b/example/lib/main_home.dart @@ -1,6 +1,5 @@ import 'package:example/tips/tips_home.dart'; import 'package:example/widgets/widgets_home.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'accessibility/neumorphic_accessibility.dart'; @@ -24,7 +23,7 @@ class MyApp extends StatelessWidget { } class FullSampleHomePage extends StatelessWidget { - Widget _buildButton({String text, VoidCallback onClick}) { + Widget _buildButton({String? text, VoidCallback? onClick}) { return NeumorphicButton( margin: EdgeInsets.only(bottom: 12), padding: EdgeInsets.symmetric( @@ -41,7 +40,7 @@ class FullSampleHomePage extends StatelessWidget { //), shape: NeumorphicShape.flat, ), - child: Center(child: Text(text)), + child: Center(child: Text(text!)), onPressed: onClick, ); } diff --git a/example/lib/playground/neumorphic_playground.dart b/example/lib/playground/neumorphic_playground.dart index eb52041c..947711c7 100644 --- a/example/lib/playground/neumorphic_playground.dart +++ b/example/lib/playground/neumorphic_playground.dart @@ -2,6 +2,8 @@ import 'package:example/lib/color_selector.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class NeumorphicPlayground extends StatefulWidget { + const NeumorphicPlayground({super.key}); + @override _NeumorphicPlaygroundState createState() => _NeumorphicPlaygroundState(); } @@ -11,7 +13,7 @@ class _NeumorphicPlaygroundState extends State { Widget build(BuildContext context) { return NeumorphicTheme( themeMode: ThemeMode.light, - theme: NeumorphicThemeData( + theme: const NeumorphicThemeData( baseColor: Color(0xffDDDDDD), lightSource: LightSource.topLeft, depth: 6, @@ -30,7 +32,7 @@ class _Page extends StatefulWidget { class __PageState extends State<_Page> { LightSource lightSource = LightSource.topLeft; NeumorphicShape shape = NeumorphicShape.flat; - NeumorphicBoxShape boxShape; + late NeumorphicBoxShape boxShape; double depth = 5; double intensity = 0.5; double surfaceIntensity = 0.5; @@ -38,10 +40,10 @@ class __PageState extends State<_Page> { double height = 150.0; double width = 150.0; - static final minWidth = 50.0; - static final maxWidth = 200.0; - static final minHeight = 50.0; - static final maxHeight = 200.0; + static const minWidth = 50.0; + static const maxWidth = 200.0; + static const minHeight = 50.0; + static const maxHeight = 200.0; bool haveNeumorphicChild = false; bool childOppositeLightsourceChild = false; @@ -68,11 +70,12 @@ class __PageState extends State<_Page> { children: [ Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), - color: Theme.of(context).accentColor, - child: Text( + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: Theme.of(context).colorScheme.secondary, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), + child: const Text( "back", style: TextStyle(color: Colors.white), ), @@ -102,14 +105,14 @@ class __PageState extends State<_Page> { int selectedConfiguratorIndex = 0; Widget _configurators() { - final Color buttonActiveColor = Theme.of(context).accentColor; - final Color buttonInnactiveColor = Colors.white; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; + const Color buttonInnactiveColor = Colors.white; - final Color textActiveColor = Colors.white; + const Color textActiveColor = Colors.white; final Color textInactiveColor = Colors.black.withOpacity(0.3); return Card( - margin: EdgeInsets.all(8), + margin: const EdgeInsets.all(8), elevation: 12, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), color: Colors.grey[300], @@ -122,12 +125,13 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), - color: selectedConfiguratorIndex == 0 - ? buttonActiveColor - : buttonInnactiveColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: selectedConfiguratorIndex == 0 + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), child: Text( "Style", style: TextStyle( @@ -148,9 +152,13 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: selectedConfiguratorIndex == 1 + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), child: Text( "Element", style: TextStyle( @@ -159,9 +167,6 @@ class __PageState extends State<_Page> { : textInactiveColor, ), ), - color: selectedConfiguratorIndex == 1 - ? buttonActiveColor - : buttonInnactiveColor, onPressed: () { setState(() { selectedConfiguratorIndex = 1; @@ -174,9 +179,13 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: selectedConfiguratorIndex == 2 + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), child: Text( "Child", style: TextStyle( @@ -185,9 +194,6 @@ class __PageState extends State<_Page> { : textInactiveColor, ), ), - color: selectedConfiguratorIndex == 2 - ? buttonActiveColor - : buttonInnactiveColor, onPressed: () { setState(() { selectedConfiguratorIndex = 2; @@ -198,23 +204,20 @@ class __PageState extends State<_Page> { ) ], ), - _configuratorsChild(), + _configuratorsChild()!, ], ), ); } - Widget _configuratorsChild() { + Widget? _configuratorsChild() { switch (selectedConfiguratorIndex) { case 0: return styleCustomizer(); - break; case 1: return elementCustomizer(); - break; case 2: return childCustomizer(); - break; } return null; } @@ -259,17 +262,17 @@ class __PageState extends State<_Page> { Widget colorPicker() { return Row( children: [ - SizedBox( + const SizedBox( width: 12, ), - Text("Color "), - SizedBox( + const Text("Color "), + const SizedBox( width: 4, ), ColorSelector( onColorChanged: (color) { setState(() { - NeumorphicTheme.of(context) + NeumorphicTheme.of(context)! .updateCurrentTheme(NeumorphicThemeData(baseColor: color)); }); }, @@ -282,7 +285,7 @@ class __PageState extends State<_Page> { Widget neumorphic() { return NeumorphicButton( padding: EdgeInsets.zero, - duration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), onPressed: () { setState(() {}); }, @@ -307,10 +310,7 @@ class __PageState extends State<_Page> { width: width, child: haveNeumorphicChild ? neumorphicChild() - : Container( - //color: Colors.blue, - child: Center(child: Text("")), - ), + : const Center(child: Text("")), ), ); } @@ -318,7 +318,7 @@ class __PageState extends State<_Page> { Widget neumorphicChild() { return Neumorphic( padding: EdgeInsets.zero, - duration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), margin: EdgeInsets.all(this.childMargin), drawSurfaceAboveChild: true, style: NeumorphicStyle( @@ -329,14 +329,14 @@ class __PageState extends State<_Page> { depth: childDepth, lightSource: this.lightSource, oppositeShadowLightSource: this.childOppositeLightsourceChild), - child: SizedBox.expand(), + child: const SizedBox.expand(), ); } Widget depthSelector() { return Row( children: [ - Padding( + const Padding( padding: EdgeInsets.only(left: 12), child: Text("Depth"), ), @@ -353,7 +353,7 @@ class __PageState extends State<_Page> { ), ), Padding( - padding: EdgeInsets.only(right: 12), + padding: const EdgeInsets.only(right: 12), child: Text(depth.floor().toString()), ), ], @@ -363,7 +363,7 @@ class __PageState extends State<_Page> { Widget childDepthSelector() { return Row( children: [ - Padding( + const Padding( padding: EdgeInsets.only(left: 12), child: Text("Child Depth"), ), @@ -380,7 +380,7 @@ class __PageState extends State<_Page> { ), ), Padding( - padding: EdgeInsets.only(right: 12), + padding: const EdgeInsets.only(right: 12), child: Text(childDepth.floor().toString()), ), ], @@ -390,7 +390,7 @@ class __PageState extends State<_Page> { Widget childMarginSelector() { return Row( children: [ - Padding( + const Padding( padding: EdgeInsets.only(left: 12), child: Text("Child Margin"), ), @@ -407,7 +407,7 @@ class __PageState extends State<_Page> { ), ), Padding( - padding: EdgeInsets.only(right: 12), + padding: const EdgeInsets.only(right: 12), child: Text(childMargin.floor().toString()), ), ], @@ -418,7 +418,7 @@ class __PageState extends State<_Page> { return Stack( alignment: Alignment.center, children: [ - Align( + const Align( alignment: Alignment.centerLeft, child: Padding( padding: EdgeInsets.only(left: 12), @@ -431,7 +431,7 @@ class __PageState extends State<_Page> { value: this.haveNeumorphicChild, onChanged: (value) { setState(() { - haveNeumorphicChild = value; + haveNeumorphicChild = value!; }); }, ), @@ -444,7 +444,7 @@ class __PageState extends State<_Page> { return Stack( alignment: Alignment.center, children: [ - Align( + const Align( alignment: Alignment.centerLeft, child: Padding( padding: EdgeInsets.only(left: 12), @@ -457,7 +457,7 @@ class __PageState extends State<_Page> { value: this.drawAboveChild, onChanged: (value) { setState(() { - drawAboveChild = value; + drawAboveChild = value!; }); }, ), @@ -470,7 +470,7 @@ class __PageState extends State<_Page> { return Stack( alignment: Alignment.center, children: [ - Align( + const Align( alignment: Alignment.centerLeft, child: Padding( padding: EdgeInsets.only(left: 12), @@ -483,7 +483,7 @@ class __PageState extends State<_Page> { value: this.childOppositeLightsourceChild, onChanged: (value) { setState(() { - childOppositeLightsourceChild = value; + childOppositeLightsourceChild = value!; }); }, ), @@ -495,10 +495,10 @@ class __PageState extends State<_Page> { Widget sizeSelector() { return Row( children: [ - SizedBox( + const SizedBox( width: 12, ), - Text("W: "), + const Text("W: "), Expanded( child: Slider( min: minWidth, @@ -511,7 +511,7 @@ class __PageState extends State<_Page> { }, ), ), - Text("H: "), + const Text("H: "), Expanded( child: Slider( min: minHeight, @@ -532,7 +532,7 @@ class __PageState extends State<_Page> { if (boxShape.isRoundRect || boxShape.isBeveled) { return Row( children: [ - Padding( + const Padding( padding: EdgeInsets.only(left: 12), child: Text("Corner"), ), @@ -557,20 +557,20 @@ class __PageState extends State<_Page> { ), ), Padding( - padding: EdgeInsets.only(right: 12), + padding: const EdgeInsets.only(right: 12), child: Text(cornerRadius.floor().toString()), ), ], ); } else { - return SizedBox(); + return const SizedBox(); } } Widget intensitySelector() { return Row( children: [ - Padding( + const Padding( padding: EdgeInsets.only(left: 12), child: Text("Intensity"), ), @@ -587,7 +587,7 @@ class __PageState extends State<_Page> { ), ), Padding( - padding: EdgeInsets.only(right: 12), + padding: const EdgeInsets.only(right: 12), child: Text(((intensity * 100).floor() / 100).toString()), ), ], @@ -597,7 +597,7 @@ class __PageState extends State<_Page> { Widget surfaceIntensitySelector() { return Row( children: [ - Padding( + const Padding( padding: EdgeInsets.only(left: 12), child: Text("SurfaceIntensity"), ), @@ -614,7 +614,7 @@ class __PageState extends State<_Page> { ), ), Padding( - padding: EdgeInsets.only(right: 12), + padding: const EdgeInsets.only(right: 12), child: Text(((surfaceIntensity * 100).floor() / 100).toString()), ), ], @@ -622,10 +622,10 @@ class __PageState extends State<_Page> { } Widget boxshapeWidget() { - final Color buttonActiveColor = Theme.of(context).accentColor; - final Color buttonInnactiveColor = Colors.white; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; + const Color buttonInnactiveColor = Colors.white; - final Color textActiveColor = Colors.white; + const Color textActiveColor = Colors.white; final Color textInactiveColor = Colors.black.withOpacity(0.3); return Row( @@ -634,18 +634,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: boxShape.isRoundRect + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { boxShape = NeumorphicBoxShape.roundRect( BorderRadius.circular(this.cornerRadius)); }); }, - color: boxShape.isRoundRect - ? buttonActiveColor - : buttonInnactiveColor, child: Text( "Rect", style: TextStyle( @@ -659,17 +660,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: boxShape.isBeveled + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { boxShape = NeumorphicBoxShape.beveled( BorderRadius.circular(this.cornerRadius)); }); }, - color: - boxShape.isBeveled ? buttonActiveColor : buttonInnactiveColor, child: Text( "Beveled", style: TextStyle( @@ -683,16 +686,18 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: boxShape.isCircle + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { - boxShape = NeumorphicBoxShape.circle(); + boxShape = const NeumorphicBoxShape.circle(); }); }, - color: - boxShape.isCircle ? buttonActiveColor : buttonInnactiveColor, child: Text( "Circle", style: TextStyle( @@ -706,16 +711,18 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: boxShape.isStadium + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { - boxShape = NeumorphicBoxShape.stadium(); + boxShape = const NeumorphicBoxShape.stadium(); }); }, - color: - boxShape.isStadium ? buttonActiveColor : buttonInnactiveColor, child: Text( "Stadium", style: TextStyle( @@ -729,18 +736,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: boxShape.isCustomPath + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { boxShape = NeumorphicBoxShape.path( NeumorphicFlutterLogoPathProvider()); }); }, - color: boxShape.isCustomPath - ? buttonActiveColor - : buttonInnactiveColor, child: Text( "Custom", style: TextStyle( @@ -756,10 +764,10 @@ class __PageState extends State<_Page> { } Widget shapeWidget() { - final Color buttonActiveColor = Theme.of(context).accentColor; - final Color buttonInnactiveColor = Colors.white; + final Color buttonActiveColor = Theme.of(context).colorScheme.secondary; + const Color buttonInnactiveColor = Colors.white; - final Color iconActiveColor = Colors.white; + const Color iconActiveColor = Colors.white; final Color iconInactiveColor = Colors.black.withOpacity(0.3); return Row( @@ -768,17 +776,18 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: shape == NeumorphicShape.concave + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { shape = NeumorphicShape.concave; }); }, - color: shape == NeumorphicShape.concave - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/concave.png", color: shape == NeumorphicShape.concave ? iconActiveColor @@ -789,17 +798,18 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: shape == NeumorphicShape.convex + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { shape = NeumorphicShape.convex; }); }, - color: shape == NeumorphicShape.convex - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/convex.png", color: shape == NeumorphicShape.convex ? iconActiveColor @@ -810,17 +820,18 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + // backgroundColor: shape == NeumorphicShape.flat + // ? buttonActiveColor + // : buttonInnactiveColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12))), onPressed: () { setState(() { shape = NeumorphicShape.flat; }); }, - color: shape == NeumorphicShape.flat - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/flat.png", color: shape == NeumorphicShape.flat ? iconActiveColor diff --git a/example/lib/playground/text_playground.dart b/example/lib/playground/text_playground.dart index f1a547cd..80a34fc0 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 { @@ -89,10 +88,12 @@ class __PageState extends State<_Page> { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), - color: Theme.of(context).accentColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: Theme.of(context).colorScheme.secondary, + ), child: Text( "back", style: TextStyle(color: Colors.white), @@ -125,7 +126,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; @@ -145,12 +146,14 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), - color: selectedConfiguratorIndex == 0 - ? buttonActiveColor - : buttonInnactiveColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: selectedConfiguratorIndex == 0 + // ? buttonActiveColor + // : buttonInnactiveColor, + ), child: Text( "Style", style: TextStyle( @@ -171,9 +174,14 @@ class __PageState extends State<_Page> { flex: 1, child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: selectedConfiguratorIndex == 1 + // ? buttonActiveColor + // : buttonInnactiveColor, + ), child: Text( "Element", style: TextStyle( @@ -182,9 +190,6 @@ class __PageState extends State<_Page> { : textInactiveColor, ), ), - color: selectedConfiguratorIndex == 1 - ? buttonActiveColor - : buttonInnactiveColor, onPressed: () { setState(() { selectedConfiguratorIndex = 1; @@ -195,20 +200,18 @@ class __PageState extends State<_Page> { ), ], ), - _configuratorsChild(), + _configuratorsChild()!, ], ), ); } - Widget _configuratorsChild() { + Widget? _configuratorsChild() { switch (selectedConfiguratorIndex) { case 0: return styleCustomizer(); - break; case 1: return elementCustomizer(); - break; } return null; } @@ -238,7 +241,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; @@ -250,17 +253,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.concave + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.concave; }); }, - color: shape == NeumorphicShape.concave - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/concave.png", color: shape == NeumorphicShape.concave ? iconActiveColor @@ -271,17 +276,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.convex + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.convex; }); }, - color: shape == NeumorphicShape.convex - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/convex.png", color: shape == NeumorphicShape.convex ? iconActiveColor @@ -292,17 +299,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.flat + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.flat; }); }, - color: shape == NeumorphicShape.flat - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/flat.png", color: shape == NeumorphicShape.flat ? iconActiveColor @@ -327,7 +336,7 @@ class __PageState extends State<_Page> { ColorSelector( onColorChanged: (color) { setState(() { - NeumorphicTheme.of(context) + NeumorphicTheme.of(context)! .updateCurrentTheme(NeumorphicThemeData(baseColor: color)); }); }, @@ -444,7 +453,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..36e44de2 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,12 +83,6 @@ class __PageState extends State<_Page> { } Widget _configurators() { - final Color buttonActiveColor = Theme.of(context).accentColor; - final Color buttonInnactiveColor = Colors.white; - - final Color textActiveColor = Colors.white; - final Color textInactiveColor = Colors.black.withOpacity(0.3); - return Column( children: [ styleCustomizer(), @@ -136,12 +128,8 @@ class __PageState extends State<_Page> { child: SizedBox( height: height, width: width, - child: haveNeumorphicChild - ? neumorphicChild() - : Container( - //color: Colors.blue, - child: Center(child: Text("")), - ), + child: + haveNeumorphicChild ? neumorphicChild() : Center(child: Text("")), ), ); } @@ -246,7 +234,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; @@ -258,17 +246,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.concave + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.concave; }); }, - color: shape == NeumorphicShape.concave - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/concave.png", color: shape == NeumorphicShape.concave ? iconActiveColor @@ -279,17 +269,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.convex + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.convex; }); }, - color: shape == NeumorphicShape.convex - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/convex.png", color: shape == NeumorphicShape.convex ? iconActiveColor @@ -300,17 +292,19 @@ class __PageState extends State<_Page> { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12)), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + // backgroundColor: shape == NeumorphicShape.flat + // ? buttonActiveColor + // : buttonInnactiveColor, + ), onPressed: () { setState(() { shape = NeumorphicShape.flat; }); }, - color: shape == NeumorphicShape.flat - ? buttonActiveColor - : buttonInnactiveColor, child: Image.asset("assets/images/flat.png", color: shape == NeumorphicShape.flat ? iconActiveColor diff --git a/example/lib/samples/audio_player_sample.dart b/example/lib/samples/audio_player_sample.dart index fee9c066..43181790 100644 --- a/example/lib/samples/audio_player_sample.dart +++ b/example/lib/samples/audio_player_sample.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class AudioPlayerSample extends StatefulWidget { @@ -94,7 +93,7 @@ class __PageState extends State<_Page> { onPressed: () { setState(() { _useDark = !_useDark; - NeumorphicTheme.of(context).themeMode = + NeumorphicTheme.of(context)!.themeMode = _useDark ? ThemeMode.dark : ThemeMode.light; }); }, @@ -235,10 +234,10 @@ class __PageState extends State<_Page> { ); } - Color _iconsColor() { + Color? _iconsColor() { final theme = NeumorphicTheme.of(context); - if (theme.isUsingDark) { - return theme.current.accentColor; + if (theme!.isUsingDark) { + return theme.current!.accentColor; } else { return null; } diff --git a/example/lib/samples/calculator_sample.dart b/example/lib/samples/calculator_sample.dart index fabf9d36..33415136 100644 --- a/example/lib/samples/calculator_sample.dart +++ b/example/lib/samples/calculator_sample.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class CalculatorSample extends StatefulWidget { @@ -64,7 +63,7 @@ class WidgetCalcButton extends StatelessWidget { } } - Color _backgroundColor(BuildContext context) { + Color? _backgroundColor(BuildContext context) { return button.backgroundAccent ? NeumorphicTheme.accentColor(context) : null; @@ -99,7 +98,7 @@ class _TopScreenWidget extends StatelessWidget { return Neumorphic( style: NeumorphicStyle( boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(12)), - depth: -1 * NeumorphicTheme.of(context).current.depth, + depth: -1 * NeumorphicTheme.of(context)!.current!.depth, ), child: FractionallySizedBox( widthFactor: 1, @@ -198,10 +197,10 @@ class __PageContentState extends State<_PageContent> { ), Row( children: [ - RaisedButton( + ElevatedButton( onPressed: () { setState(() { - NeumorphicTheme.of(context) + NeumorphicTheme.of(context)! .updateCurrentTheme(NeumorphicThemeData( depth: 1, intensity: 0.5, @@ -213,10 +212,10 @@ class __PageContentState extends State<_PageContent> { "style 1", ), ), - RaisedButton( + ElevatedButton( onPressed: () { setState(() { - NeumorphicTheme.of(context) + NeumorphicTheme.of(context)! .updateCurrentTheme(NeumorphicThemeData( depth: 8, intensity: 0.3, diff --git a/example/lib/samples/clock/clock_sample.dart b/example/lib/samples/clock/clock_sample.dart index 05bc41e9..45420a25 100644 --- a/example/lib/samples/clock/clock_sample.dart +++ b/example/lib/samples/clock/clock_sample.dart @@ -1,5 +1,4 @@ import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'clock_second_sample.dart'; @@ -40,7 +39,9 @@ class _ClockFirstPageState extends State<_ClockFirstPage> { children: [ Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 9.0), - child: TopBar(), + child: TopBar( + actions: [], + ), ), Padding( padding: EdgeInsets.symmetric(horizontal: 20.0), @@ -229,16 +230,16 @@ class NeumorphicClock extends StatelessWidget { } Widget _buildLine( - {BuildContext context, - double angle, - double width, + {BuildContext? context, + double? angle, + double? width, double height = 6, - Color color}) { + Color? color}) { return Transform.rotate( - angle: angle, + angle: angle!, child: Center( child: Padding( - padding: EdgeInsets.only(left: width), + padding: EdgeInsets.only(left: width!), child: Neumorphic( style: NeumorphicStyle( depth: 20, diff --git a/example/lib/samples/clock/clock_second_sample.dart b/example/lib/samples/clock/clock_second_sample.dart index 91873349..9180b4df 100644 --- a/example/lib/samples/clock/clock_second_sample.dart +++ b/example/lib/samples/clock/clock_second_sample.dart @@ -1,5 +1,4 @@ import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class ClockAlarmPage extends StatelessWidget { @@ -61,7 +60,9 @@ class _ClockPageState extends State<_Page> { children: [ Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 9.0), - child: TopBar(), + child: TopBar( + actions: [], + ), ), Padding( padding: EdgeInsets.symmetric(horizontal: 20.0), @@ -230,8 +231,8 @@ class Alarm { final String label; const Alarm({ - @required this.enabled, - @required this.time, - @required this.label, + required this.enabled, + required this.time, + required this.label, }); } diff --git a/example/lib/samples/credit_card_sample.dart b/example/lib/samples/credit_card_sample.dart index de640f5b..ff909bd6 100644 --- a/example/lib/samples/credit_card_sample.dart +++ b/example/lib/samples/credit_card_sample.dart @@ -1,7 +1,5 @@ import 'dart:ui'; -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class CreditCardSample extends StatefulWidget { @@ -57,147 +55,145 @@ class __PageContentState extends State<_PageContent> { } Widget _buildCard(BuildContext context) { - return Container( + return Neumorphic( + style: NeumorphicStyle( + depth: 10, + boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(20)), + shape: NeumorphicShape.flat, + ), child: Neumorphic( + margin: EdgeInsets.all(8), style: NeumorphicStyle( depth: 10, boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(20)), shape: NeumorphicShape.flat, ), - child: Neumorphic( - margin: EdgeInsets.all(8), - style: NeumorphicStyle( - depth: 10, - boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(20)), - shape: NeumorphicShape.flat, - ), - child: SizedBox( - height: 200, - child: AspectRatio( - aspectRatio: 9 / 16, - child: Stack( - fit: StackFit.expand, - children: [ - //Image.asset("assets/images/map.jpg", fit: BoxFit.cover), - BackdropFilter( - filter: ImageFilter.blur(sigmaX: 3, sigmaY: 3), - child: Container( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topRight, - end: Alignment.bottomLeft, - colors: [ - Colors.purple.withOpacity(0.5), - Colors.red.withOpacity(0.5) - ])), - ), + child: SizedBox( + height: 200, + child: AspectRatio( + aspectRatio: 9 / 16, + child: Stack( + fit: StackFit.expand, + children: [ + //Image.asset("assets/images/map.jpg", fit: BoxFit.cover), + BackdropFilter( + filter: ImageFilter.blur(sigmaX: 3, sigmaY: 3), + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + Colors.purple.withOpacity(0.5), + Colors.red.withOpacity(0.5) + ])), ), - Stack( - children: [ - Positioned( - top: 12, - left: 16, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "VISA", - style: TextStyle( - fontSize: 40, - color: Colors.white, - fontWeight: FontWeight.w800), - ), - SizedBox( - height: 30, - ), - Text( - "1234 5678", - style: TextStyle( - fontSize: 30, - color: Colors.black.withOpacity(0.7)), - ), - SizedBox( - height: 3, - ), - Text( - "1234 5678", - style: TextStyle( - fontSize: 30, - color: Colors.black.withOpacity(0.7)), - ), - ], - ), + ), + Stack( + children: [ + Positioned( + top: 12, + left: 16, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "VISA", + style: TextStyle( + fontSize: 40, + color: Colors.white, + fontWeight: FontWeight.w800), + ), + SizedBox( + height: 30, + ), + Text( + "1234 5678", + style: TextStyle( + fontSize: 30, + color: Colors.black.withOpacity(0.7)), + ), + SizedBox( + height: 3, + ), + Text( + "1234 5678", + style: TextStyle( + fontSize: 30, + color: Colors.black.withOpacity(0.7)), + ), + ], ), - Positioned( - top: 12, - right: 16, - child: SizedBox( - height: 60, - child: Neumorphic( - style: NeumorphicStyle( - depth: 5, - intensity: 0.8, - lightSource: LightSource.topLeft, - boxShape: NeumorphicBoxShape.roundRect( - BorderRadius.circular(12), - ), + ), + Positioned( + top: 12, + right: 16, + child: SizedBox( + height: 60, + child: Neumorphic( + style: NeumorphicStyle( + depth: 5, + intensity: 0.8, + lightSource: LightSource.topLeft, + boxShape: NeumorphicBoxShape.roundRect( + BorderRadius.circular(12), ), - child: RotatedBox( - quarterTurns: 1, - child: Image.asset( - "assets/images/credit_card_chip.png")), ), + child: RotatedBox( + quarterTurns: 1, + child: Image.asset( + "assets/images/credit_card_chip.png")), ), ), - Positioned( - bottom: 12, - right: 16, - child: Column( - children: [ - Text( - "09/24", - style: TextStyle( - fontSize: 20, - color: Colors.white.withOpacity(0.7)), - ), - SizedBox( - height: 8, - ), - Stack( - children: [ - Neumorphic( + ), + Positioned( + bottom: 12, + right: 16, + child: Column( + children: [ + Text( + "09/24", + style: TextStyle( + fontSize: 20, + color: Colors.white.withOpacity(0.7)), + ), + SizedBox( + height: 8, + ), + Stack( + children: [ + Neumorphic( + style: NeumorphicStyle( + shape: NeumorphicShape.convex, + depth: -10, + boxShape: NeumorphicBoxShape.circle(), + color: Colors.grey[300]), + child: const SizedBox( + height: 30, + width: 30, + ), + ), + Padding( + padding: EdgeInsets.only(left: 18), + child: Neumorphic( style: NeumorphicStyle( shape: NeumorphicShape.convex, - depth: -10, boxShape: NeumorphicBoxShape.circle(), - color: Colors.grey[300]), + depth: 10), child: const SizedBox( height: 30, width: 30, ), ), - Padding( - padding: EdgeInsets.only(left: 18), - child: Neumorphic( - style: NeumorphicStyle( - shape: NeumorphicShape.convex, - boxShape: NeumorphicBoxShape.circle(), - depth: 10), - child: const SizedBox( - height: 30, - width: 30, - ), - ), - ), - ], - ), - ], - ), - ) - ], - ), - ], - ), + ), + ], + ), + ], + ), + ) + ], + ), + ], ), ), ), @@ -235,7 +231,7 @@ class __PageContentState extends State<_PageContent> { setState(() { _useDark = !_useDark; - NeumorphicTheme.of(context).themeMode = + NeumorphicTheme.of(context)!.themeMode = _useDark ? ThemeMode.dark : ThemeMode.light; }); }, @@ -328,7 +324,7 @@ class __PageContentState extends State<_PageContent> { value: 0, onChanged: (value) { setState(() { - _dotIndex = value; + _dotIndex = value! as int; }); }, style: NeumorphicRadioStyle( @@ -348,7 +344,7 @@ class __PageContentState extends State<_PageContent> { value: 1, onChanged: (value) { setState(() { - _dotIndex = value; + _dotIndex = value! as int; }); }, style: NeumorphicRadioStyle( @@ -368,7 +364,7 @@ class __PageContentState extends State<_PageContent> { value: 2, onChanged: (value) { setState(() { - _dotIndex = value; + _dotIndex = value! as int; }); }, style: NeumorphicRadioStyle( diff --git a/example/lib/samples/form_sample.dart b/example/lib/samples/form_sample.dart index 7d6af0cc..df25cb63 100644 --- a/example/lib/samples/form_sample.dart +++ b/example/lib/samples/form_sample.dart @@ -1,6 +1,5 @@ import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class FormSample extends StatelessWidget { @@ -35,7 +34,7 @@ class __PageState extends State<_Page> { String firstName = ""; String lastName = ""; double age = 12; - Gender gender; + late Gender gender = Gender.NON_BINARY; Set rides = Set(); @override @@ -181,7 +180,7 @@ class _AgeField extends StatelessWidget { final double age; final ValueChanged onChanged; - _AgeField({@required this.age, this.onChanged}); + _AgeField({required this.age, required this.onChanged}); @override Widget build(BuildContext context) { @@ -230,14 +229,15 @@ class _TextField extends StatefulWidget { final ValueChanged onChanged; - _TextField({@required this.label, @required this.hint, this.onChanged}); + _TextField( + {required this.label, required this.hint, required this.onChanged}); @override __TextFieldState createState() => __TextFieldState(); } class __TextFieldState extends State<_TextField> { - TextEditingController _controller; + late TextEditingController _controller; @override void initState() { @@ -283,8 +283,8 @@ class _GenderField extends StatelessWidget { final ValueChanged onChanged; const _GenderField({ - @required this.gender, - @required this.onChanged, + required this.gender, + required this.onChanged, }); @override @@ -313,7 +313,7 @@ class _GenderField extends StatelessWidget { ), value: Gender.MALE, child: Icon(Icons.account_box), - onChanged: (value) => this.onChanged(value), + onChanged: (value) => this.onChanged(value! as Gender), ), SizedBox(width: 12), NeumorphicRadio( @@ -324,7 +324,7 @@ class _GenderField extends StatelessWidget { ), value: Gender.FEMALE, child: Icon(Icons.pregnant_woman), - onChanged: (value) => this.onChanged(value), + onChanged: (value) => this.onChanged(value! as Gender), ), SizedBox(width: 12), NeumorphicRadio( @@ -335,7 +335,7 @@ class _GenderField extends StatelessWidget { ), value: Gender.NON_BINARY, child: Icon(Icons.supervised_user_circle), - onChanged: (value) => this.onChanged(value), + onChanged: (value) => this.onChanged(value! as Gender), ), SizedBox( width: 18, diff --git a/example/lib/samples/galaxy_sample.dart b/example/lib/samples/galaxy_sample.dart index 5bae0f8e..aca638ca 100644 --- a/example/lib/samples/galaxy_sample.dart +++ b/example/lib/samples/galaxy_sample.dart @@ -1,6 +1,5 @@ import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class GalaxySample extends StatelessWidget { diff --git a/example/lib/samples/sample_home.dart b/example/lib/samples/sample_home.dart index e4e120a0..e2885582 100644 --- a/example/lib/samples/sample_home.dart +++ b/example/lib/samples/sample_home.dart @@ -5,14 +5,13 @@ import 'package:example/samples/clock/clock_sample.dart'; import 'package:example/samples/credit_card_sample.dart'; import 'package:example/samples/form_sample.dart'; import 'package:example/samples/testla_sample.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'galaxy_sample.dart'; import 'widgets_sample.dart'; class SamplesHome extends StatelessWidget { - Widget _buildButton({String text, VoidCallback onClick}) { + Widget _buildButton({required String text, VoidCallback? onClick}) { return NeumorphicButton( margin: EdgeInsets.only(bottom: 12), padding: EdgeInsets.symmetric( @@ -46,7 +45,9 @@ class SamplesHome extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - TopBar(), + TopBar( + actions: [], + ), _buildButton( text: "Tesla", onClick: () { diff --git a/example/lib/samples/testla_sample.dart b/example/lib/samples/testla_sample.dart index 400ecf07..a9c69bfd 100644 --- a/example/lib/samples/testla_sample.dart +++ b/example/lib/samples/testla_sample.dart @@ -1,7 +1,3 @@ -import 'dart:ui'; - -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class TeslaSample extends StatefulWidget { diff --git a/example/lib/samples/widgets_sample.dart b/example/lib/samples/widgets_sample.dart index a98f67fc..113e6fc6 100644 --- a/example/lib/samples/widgets_sample.dart +++ b/example/lib/samples/widgets_sample.dart @@ -1,15 +1,14 @@ -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class WidgetsSample extends StatefulWidget { - WidgetsSample({Key key}) : super(key: key); + WidgetsSample({Key? key}) : super(key: key); @override createState() => _ContainersListPageState(); } class _ContainersListPageState extends State { - int _groupValue; + int _groupValue = 1; bool _switchConcaveEnabled = false; bool _switchConvexEnabled = false; bool _switchFlatEnabled = false; @@ -125,7 +124,7 @@ class _ContainersListPageState extends State { groupValue: _groupValue, onChanged: (value) { setState(() { - _groupValue = value; + _groupValue = value! as int; }); }, ), @@ -145,7 +144,7 @@ class _ContainersListPageState extends State { groupValue: _groupValue, onChanged: (value) { setState(() { - _groupValue = value; + _groupValue = value! as int; }); }, ), @@ -165,7 +164,7 @@ class _ContainersListPageState extends State { groupValue: _groupValue, onChanged: (value) { setState(() { - _groupValue = value; + _groupValue = value! as int; }); }, ), diff --git a/example/lib/tips/border/tips_border.dart b/example/lib/tips/border/tips_border.dart index 69e04ea3..0e88e8ff 100644 --- a/example/lib/tips/border/tips_border.dart +++ b/example/lib/tips/border/tips_border.dart @@ -1,11 +1,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class TipsBorderPage extends StatefulWidget { - TipsBorderPage({Key key}) : super(key: key); + TipsBorderPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -149,9 +148,9 @@ class _CustomWidget extends StatefulWidget { final NeumorphicStyle secondStyle; _CustomWidget( - {@required this.title, - @required this.firstStyle, - @required this.secondStyle}); + {required this.title, + required this.firstStyle, + required this.secondStyle}); @override createState() => _CustomWidgetState(); diff --git a/example/lib/tips/border/tips_emboss_inside_emboss.dart b/example/lib/tips/border/tips_emboss_inside_emboss.dart index c9e03ae8..f106ca18 100644 --- a/example/lib/tips/border/tips_emboss_inside_emboss.dart +++ b/example/lib/tips/border/tips_emboss_inside_emboss.dart @@ -1,11 +1,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class TipsRecursiveeEmbossPage extends StatefulWidget { - TipsRecursiveeEmbossPage({Key key}) : super(key: key); + TipsRecursiveeEmbossPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -88,14 +87,14 @@ class _EmbossmbossWidgetState extends State<_EmbossmbossWidget> { } Widget _generateEmbosss( - {int number, Widget child, bool reverseEachPair = false}) { + {int? number, required Widget child, bool reverseEachPair = false}) { Widget element = child; - for (int i = 0; i < number; ++i) { + for (int i = 0; i < number!; ++i) { element = Neumorphic( padding: EdgeInsets.all(20), style: NeumorphicStyle( boxShape: NeumorphicBoxShape.circle(), - depth: -(NeumorphicTheme.depth(context).abs()), //force negative + depth: -(NeumorphicTheme.depth(context)!.abs()), //force negative oppositeShadowLightSource: (reverseEachPair && i % 2 == 0), ), child: element, diff --git a/example/lib/tips/tips_home.dart b/example/lib/tips/tips_home.dart index 945a5e35..47e8e96e 100644 --- a/example/lib/tips/tips_home.dart +++ b/example/lib/tips/tips_home.dart @@ -1,12 +1,11 @@ import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'border/tips_border.dart'; import 'border/tips_emboss_inside_emboss.dart'; class TipsHome extends StatelessWidget { - Widget _buildButton({String text, VoidCallback onClick}) { + Widget _buildButton({String? text, VoidCallback? onClick}) { return NeumorphicButton( margin: EdgeInsets.only(bottom: 12), padding: EdgeInsets.symmetric( @@ -19,7 +18,7 @@ class TipsHome extends StatelessWidget { BorderRadius.circular(12), ), ), - child: Center(child: Text(text)), + child: Center(child: Text(text!)), onPressed: onClick, ); } @@ -39,7 +38,10 @@ class TipsHome extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - TopBar(title: "Tips"), + TopBar( + title: "Tips", + actions: [], + ), _buildButton( text: "Border", onClick: () { @@ -53,7 +55,9 @@ class TipsHome extends StatelessWidget { onClick: () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) { - return TipsRecursiveeEmbossPage(); + return TipsRecursiveeEmbossPage( + key: null, + ); })); }), ], diff --git a/example/lib/widgets/appbar/widget_app_bar.dart b/example/lib/widgets/appbar/widget_app_bar.dart index 6e4549e7..de6cf03b 100644 --- a/example/lib/widgets/appbar/widget_app_bar.dart +++ b/example/lib/widgets/appbar/widget_app_bar.dart @@ -1,9 +1,7 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class AppBarWidgetPage extends StatelessWidget { - AppBarWidgetPage({Key key}) : super(key: key); + AppBarWidgetPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -152,7 +150,7 @@ class FirstThemeContent extends StatelessWidget { class _MyDrawer extends StatelessWidget { final bool isLead; - const _MyDrawer({Key key, this.isLead = true}) : super(key: key); + const _MyDrawer({Key? key, this.isLead = true}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/example/lib/widgets/background/widget_background.dart b/example/lib/widgets/background/widget_background.dart index aa35b588..c32edccc 100644 --- a/example/lib/widgets/background/widget_background.dart +++ b/example/lib/widgets/background/widget_background.dart @@ -1,11 +1,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class BackgroundWidgetPage extends StatefulWidget { - BackgroundWidgetPage({Key key}) : super(key: key); + BackgroundWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); diff --git a/example/lib/widgets/button/button.dart b/example/lib/widgets/button/button.dart index cb8e6319..6e25bb34 100644 --- a/example/lib/widgets/button/button.dart +++ b/example/lib/widgets/button/button.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class ButtonSample extends StatefulWidget { @@ -42,17 +41,17 @@ class __PageState extends State<_Page> { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - RaisedButton( + ElevatedButton( onPressed: () { Navigator.of(context).pop(); }, child: Text("back"), ), - RaisedButton( + ElevatedButton( onPressed: () { setState(() { _useDark = !_useDark; - NeumorphicTheme.of(context).themeMode = + NeumorphicTheme.of(context)!.themeMode = _useDark ? ThemeMode.dark : ThemeMode.light; }); }, @@ -87,10 +86,10 @@ class __PageState extends State<_Page> { ); } - Color _iconsColor() { + Color? _iconsColor() { final theme = NeumorphicTheme.of(context); - if (theme.isUsingDark) { - return theme.current.accentColor; + if (theme!.isUsingDark) { + return theme.current!.accentColor; } else { return null; } diff --git a/example/lib/widgets/button/widget_button.dart b/example/lib/widgets/button/widget_button.dart index 117225b3..37592421 100644 --- a/example/lib/widgets/button/widget_button.dart +++ b/example/lib/widgets/button/widget_button.dart @@ -2,11 +2,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class ButtonWidgetPage extends StatefulWidget { - ButtonWidgetPage({Key key}) : super(key: key); + ButtonWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); diff --git a/example/lib/widgets/checkbox/widget_checkbox.dart b/example/lib/widgets/checkbox/widget_checkbox.dart index 1412294c..3627b1bf 100644 --- a/example/lib/widgets/checkbox/widget_checkbox.dart +++ b/example/lib/widgets/checkbox/widget_checkbox.dart @@ -2,11 +2,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class CheckboxWidgetPage extends StatefulWidget { - CheckboxWidgetPage({Key key}) : super(key: key); + CheckboxWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); diff --git a/example/lib/widgets/container/widget_container.dart b/example/lib/widgets/container/widget_container.dart index 90cafbf4..8e48f79b 100644 --- a/example/lib/widgets/container/widget_container.dart +++ b/example/lib/widgets/container/widget_container.dart @@ -2,11 +2,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class ContainerWidgetPage extends StatefulWidget { - ContainerWidgetPage({Key key}) : super(key: key); + ContainerWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); diff --git a/example/lib/widgets/icon/widget_icon.dart b/example/lib/widgets/icon/widget_icon.dart index deb111ed..e5067032 100644 --- a/example/lib/widgets/icon/widget_icon.dart +++ b/example/lib/widgets/icon/widget_icon.dart @@ -1,10 +1,9 @@ import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class IconWidgetPage extends StatefulWidget { - IconWidgetPage({Key key}) : super(key: key); + IconWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -741,7 +740,7 @@ class _PageState extends State<_Page> { Icons.picture_in_picture, Icons.picture_in_picture_alt, Icons.pie_chart, - Icons.pie_chart_outlined, + Icons.pie_chart_outline, Icons.pin_drop, Icons.place, Icons.play_arrow, diff --git a/example/lib/widgets/indeterminate_progress/widget_indeterminate_progress.dart b/example/lib/widgets/indeterminate_progress/widget_indeterminate_progress.dart index 09f2b289..95ccf5d6 100644 --- a/example/lib/widgets/indeterminate_progress/widget_indeterminate_progress.dart +++ b/example/lib/widgets/indeterminate_progress/widget_indeterminate_progress.dart @@ -2,11 +2,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class IndeterminateProgressWidgetPage extends StatefulWidget { - IndeterminateProgressWidgetPage({Key key}) : super(key: key); + IndeterminateProgressWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); diff --git a/example/lib/widgets/indicator/widget_indicator.dart b/example/lib/widgets/indicator/widget_indicator.dart index a5c42247..fca02508 100644 --- a/example/lib/widgets/indicator/widget_indicator.dart +++ b/example/lib/widgets/indicator/widget_indicator.dart @@ -2,13 +2,12 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'dart:math' show Random; class IndicatorWidgetPage extends StatefulWidget { - IndicatorWidgetPage({Key key}) : super(key: key); + IndicatorWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -102,7 +101,7 @@ NeumorphicIndicator( percent: percent, ), SizedBox(width: 12), - FlatButton( + TextButton( child: Text('Update'), onPressed: () { setState(() { @@ -298,7 +297,7 @@ NeumorphicIndicator( duration: Duration(seconds: 1), ), SizedBox(width: 12), - FlatButton( + TextButton( child: Text('Update'), onPressed: () { setState(() { @@ -356,7 +355,7 @@ NeumorphicIndicator( percent: percent, curve: Curves.bounceOut), SizedBox(width: 12), - FlatButton( + TextButton( child: Text('Update'), onPressed: () { setState(() { diff --git a/example/lib/widgets/progress/widget_progress.dart b/example/lib/widgets/progress/widget_progress.dart index 7867cb06..1084d085 100644 --- a/example/lib/widgets/progress/widget_progress.dart +++ b/example/lib/widgets/progress/widget_progress.dart @@ -1,13 +1,12 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'dart:math' show Random; class ProgressWidgetPage extends StatefulWidget { - ProgressWidgetPage({Key key}) : super(key: key); + ProgressWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -42,6 +41,7 @@ class _PageState extends State<_Page> { child: Scaffold( appBar: TopBar( title: "Progress", + actions: [], ), backgroundColor: Colors.transparent, body: SingleChildScrollView( @@ -110,7 +110,7 @@ Expanded( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ _buildWidget(context), - FlatButton( + TextButton( child: Text('Update'), onPressed: () { setState(() { @@ -323,7 +323,7 @@ Expanded( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ _buildWidget(context), - FlatButton( + TextButton( child: Text('Update'), onPressed: () { setState(() { @@ -384,7 +384,7 @@ Expanded( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ _buildWidget(context), - FlatButton( + TextButton( child: Text('Update'), onPressed: () { setState(() { diff --git a/example/lib/widgets/radiobutton/widget_radio_button.dart b/example/lib/widgets/radiobutton/widget_radio_button.dart index f8e1434f..8b5123d6 100644 --- a/example/lib/widgets/radiobutton/widget_radio_button.dart +++ b/example/lib/widgets/radiobutton/widget_radio_button.dart @@ -1,11 +1,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class RadioButtonWidgetPage extends StatefulWidget { - RadioButtonWidgetPage({Key key}) : super(key: key); + RadioButtonWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -69,7 +68,7 @@ class _DefaultWidget extends StatefulWidget { } class _DefaultWidgetState extends State<_DefaultWidget> { - int groupValue; + late int groupValue; Widget _buildCode(BuildContext context) { return Code(""" @@ -108,7 +107,7 @@ NeumorphicRadio( value: 1991, onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as int; }); }, padding: EdgeInsets.all(8.0), @@ -120,7 +119,7 @@ NeumorphicRadio( groupValue: groupValue, onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as int; }); }, padding: EdgeInsets.all(8.0), @@ -132,7 +131,7 @@ NeumorphicRadio( value: 2012, onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as int; }); }, padding: EdgeInsets.all(8.0), @@ -160,7 +159,7 @@ class CircleRadios extends StatefulWidget { } class _CircleRadiosState extends State { - String groupValue; + late String groupValue; Widget _buildCode(BuildContext context) { return Code(""" @@ -198,7 +197,7 @@ NeumorphicRadio( value: "A", onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as String; }); }, padding: EdgeInsets.all(18.0), @@ -213,7 +212,7 @@ NeumorphicRadio( groupValue: groupValue, onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as String; }); }, padding: EdgeInsets.all(18.0), @@ -228,7 +227,7 @@ NeumorphicRadio( value: "C", onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as String; }); }, padding: EdgeInsets.all(18.0), @@ -256,7 +255,7 @@ class _EnabledDisabledWidget extends StatefulWidget { } class _EnabledDisabledWidgetState extends State<_EnabledDisabledWidget> { - int groupValue; + late int groupValue; Widget _buildWidget(BuildContext context) { return Padding( @@ -275,7 +274,7 @@ class _EnabledDisabledWidgetState extends State<_EnabledDisabledWidget> { child: Text("First"), onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as int; }); }, ), @@ -293,7 +292,7 @@ class _EnabledDisabledWidgetState extends State<_EnabledDisabledWidget> { child: Text("Second"), onChanged: (value) { setState(() { - groupValue = value; + groupValue = value! as int; }); }, ), diff --git a/example/lib/widgets/range_slider/widget_range_slider.dart b/example/lib/widgets/range_slider/widget_range_slider.dart index c8c312f3..2b04e7f0 100644 --- a/example/lib/widgets/range_slider/widget_range_slider.dart +++ b/example/lib/widgets/range_slider/widget_range_slider.dart @@ -2,11 +2,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class RangeSliderWidgetPage extends StatefulWidget { - RangeSliderWidgetPage({Key key}) : super(key: key); + RangeSliderWidgetPage({Key? key}) : super(key: key); @override createState() => _RangeWidgetPageState(); diff --git a/example/lib/widgets/slider/widget_slider.dart b/example/lib/widgets/slider/widget_slider.dart index 522c9c30..beb1450a 100644 --- a/example/lib/widgets/slider/widget_slider.dart +++ b/example/lib/widgets/slider/widget_slider.dart @@ -2,11 +2,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class SliderWidgetPage extends StatefulWidget { - SliderWidgetPage({Key key}) : super(key: key); + SliderWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); diff --git a/example/lib/widgets/switch/widget_switch.dart b/example/lib/widgets/switch/widget_switch.dart index cb26b465..2e639f5f 100644 --- a/example/lib/widgets/switch/widget_switch.dart +++ b/example/lib/widgets/switch/widget_switch.dart @@ -2,11 +2,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/color_selector.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class SwitchWidgetPage extends StatefulWidget { - SwitchWidgetPage({Key key}) : super(key: key); + SwitchWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -110,7 +109,7 @@ NeumorphicSwitch( }, ), SizedBox(width: 12), - FlatButton( + TextButton( onPressed: () { setState(() { isEnabled = !isEnabled; diff --git a/example/lib/widgets/toggle/widget_toggle.dart b/example/lib/widgets/toggle/widget_toggle.dart index c2ebbf80..19afb18c 100644 --- a/example/lib/widgets/toggle/widget_toggle.dart +++ b/example/lib/widgets/toggle/widget_toggle.dart @@ -1,11 +1,10 @@ import 'package:example/lib/Code.dart'; import 'package:example/lib/ThemeConfigurator.dart'; import 'package:example/lib/top_bar.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; class ToggleWidgetPage extends StatefulWidget { - ToggleWidgetPage({Key key}) : super(key: key); + ToggleWidgetPage({Key? key}) : super(key: key); @override createState() => _WidgetPageState(); @@ -272,7 +271,7 @@ NeumorphicToggle( ), onAnimationChangedFinished: (value) { if (value == 0) { - Scaffold.of(context) + ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text('on back !'))); print("onAnimationChangedFinished: $_selectedIndex"); } diff --git a/example/lib/widgets/widgets_home.dart b/example/lib/widgets/widgets_home.dart index 4cea506b..1f68f5fc 100644 --- a/example/lib/widgets/widgets_home.dart +++ b/example/lib/widgets/widgets_home.dart @@ -1,7 +1,6 @@ import 'package:example/lib/top_bar.dart'; import 'package:example/widgets/appbar/widget_app_bar.dart'; import 'package:example/widgets/toggle/widget_toggle.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'background/widget_background.dart'; @@ -18,7 +17,7 @@ import 'slider/widget_slider.dart'; import 'switch/widget_switch.dart'; class WidgetsHome extends StatelessWidget { - Widget _buildButton({String text, VoidCallback onClick}) { + Widget _buildButton({String? text, VoidCallback? onClick}) { return NeumorphicButton( margin: EdgeInsets.only(bottom: 12), padding: EdgeInsets.symmetric( @@ -31,7 +30,7 @@ class WidgetsHome extends StatelessWidget { ), shape: NeumorphicShape.flat, ), - child: Center(child: Text(text)), + child: Center(child: Text(text!)), onPressed: onClick, ); } @@ -51,7 +50,10 @@ class WidgetsHome extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - TopBar(title: "Widgets"), + TopBar( + title: "Widgets", + actions: [], + ), _buildButton( text: "Container", onClick: () { diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index cf981460..cccf817a 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -2,8 +2,6 @@ // Generated file. Do not edit. // -// clang-format off - import FlutterMacOS import Foundation diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 5f19d033..be7c7c6a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -14,7 +14,7 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: ">=2.6.0 <3.0.0" + sdk: '>=2.17.0<3.0.0' dependencies: flutter: @@ -23,7 +23,7 @@ dependencies: flutter_neumorphic: path: ../ - flutter_colorpicker: ^0.4.0 + flutter_colorpicker: ^1.0.3 dev_dependencies: flutter_test: diff --git a/lib/src/widget/slider.dart b/lib/src/widget/slider.dart index 4e5a5eed..54e79c4c 100644 --- a/lib/src/widget/slider.dart +++ b/lib/src/widget/slider.dart @@ -139,7 +139,7 @@ class _NeumorphicSliderState extends State { Widget build(BuildContext context) { return LayoutBuilder(builder: (context, constraints) { return GestureDetector( - onPanUpdate: (DragUpdateDetails details) { + onHorizontalDragUpdate: (DragUpdateDetails details) { final tapPos = details.localPosition; final newPercent = tapPos.dx / constraints.maxWidth; final newValue = @@ -150,12 +150,12 @@ class _NeumorphicSliderState extends State { widget.onChanged!(newValue); } }, - onPanStart: (DragStartDetails details) { + onHorizontalDragStart: (DragStartDetails details) { if (widget.onChangeStart != null) { widget.onChangeStart!(widget.value); } }, - onPanEnd: (details) { + onHorizontalDragEnd: (details) { if (widget.onChangeEnd != null) { widget.onChangeEnd!(widget.value); } diff --git a/lib/src/widget/toggle.dart b/lib/src/widget/toggle.dart index cfb560e0..a6922312 100644 --- a/lib/src/widget/toggle.dart +++ b/lib/src/widget/toggle.dart @@ -193,15 +193,7 @@ class NeumorphicToggle extends StatelessWidget { child: FractionallySizedBox( widthFactor: 1 / this.children.length, heightFactor: 1, - child: Neumorphic( - style: NeumorphicStyle( - boxShape: NeumorphicBoxShape.roundRect( - this.style?.borderRadius ?? - BorderRadius.all(Radius.circular(12))), - ), - margin: this.padding, - child: this.thumb, - ), + child: this.thumb, ), ), Row(