Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code cleanup according to best practices. #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/lib/accessibility/neumorphic_accessibility.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/lib/color_selector.dart';
import '../lib/color_selector.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';

Expand Down
4 changes: 2 additions & 2 deletions example/lib/main_home.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:example/tips/tips_home.dart';
import 'package:example/widgets/widgets_home.dart';
import 'tips/tips_home.dart';
import 'widgets/widgets_home.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';

Expand Down
2 changes: 1 addition & 1 deletion example/lib/playground/neumorphic_playground.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/lib/color_selector.dart';
import '../lib/color_selector.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';

class NeumorphicPlayground extends StatefulWidget {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/playground/text_playground.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/lib/color_selector.dart';
import '../lib/color_selector.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';

Expand Down Expand Up @@ -444,7 +444,7 @@ class __PageState extends State<_Page> {
}

FontWeight _fontWeight() {
switch ((this.fontWeight / 100).toInt()) {
switch (this.fontWeight ~/ 100) {
case 1:
return FontWeight.w100;
case 2:
Expand Down
7 changes: 0 additions & 7 deletions example/lib/sample_neumorphic_playground.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:example/lib/color_selector.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';

Expand Down Expand Up @@ -85,12 +84,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: <Widget>[
styleCustomizer(),
Expand Down
3 changes: 1 addition & 2 deletions example/lib/samples/clock/clock_sample.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:example/lib/top_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';

import '../../lib/top_bar.dart';
import 'clock_second_sample.dart';

class ClockSample extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/samples/clock/clock_second_sample.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:example/lib/top_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import '../../lib/top_bar.dart';

class ClockAlarmPage extends StatelessWidget {
@override
Expand Down
4 changes: 2 additions & 2 deletions example/lib/samples/form_sample.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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';
import '../lib/ThemeConfigurator.dart';
import '../lib/top_bar.dart';

class FormSample extends StatelessWidget {
@override
Expand Down
4 changes: 2 additions & 2 deletions example/lib/samples/galaxy_sample.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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';
import '../lib/ThemeConfigurator.dart';
import '../lib/top_bar.dart';

class GalaxySample extends StatelessWidget {
@override
Expand Down
15 changes: 7 additions & 8 deletions example/lib/samples/sample_home.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'package:example/lib/top_bar.dart';
import 'package:example/samples/audio_player_sample.dart';
import 'package:example/samples/calculator_sample.dart';
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 '../lib/top_bar.dart';
import '../samples/audio_player_sample.dart';
import '../samples/calculator_sample.dart';
import '../samples/clock/clock_sample.dart';
import '../samples/credit_card_sample.dart';
import '../samples/form_sample.dart';
import '../samples/testla_sample.dart';
import 'galaxy_sample.dart';
import 'widgets_sample.dart';

Expand Down
6 changes: 3 additions & 3 deletions example/lib/tips/border/tips_border.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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';
import '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/top_bar.dart';

class TipsBorderPage extends StatefulWidget {
TipsBorderPage({Key key}) : super(key: key);
Expand Down
6 changes: 3 additions & 3 deletions example/lib/tips/border/tips_emboss_inside_emboss.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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';
import '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/top_bar.dart';

class TipsRecursiveeEmbossPage extends StatefulWidget {
TipsRecursiveeEmbossPage({Key key}) : super(key: key);
Expand Down
3 changes: 1 addition & 2 deletions example/lib/tips/tips_home.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:example/lib/top_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';

import '../lib/top_bar.dart';
import 'border/tips_border.dart';
import 'border/tips_emboss_inside_emboss.dart';

Expand Down
6 changes: 3 additions & 3 deletions example/lib/widgets/background/widget_background.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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';
import '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/top_bar.dart';

class BackgroundWidgetPage extends StatefulWidget {
BackgroundWidgetPage({Key key}) : super(key: key);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/widgets/button/widget_button.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

class ButtonWidgetPage extends StatefulWidget {
ButtonWidgetPage({Key key}) : super(key: key);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/widgets/checkbox/widget_checkbox.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

class CheckboxWidgetPage extends StatefulWidget {
CheckboxWidgetPage({Key key}) : super(key: key);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/widgets/container/widget_container.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

class ContainerWidgetPage extends StatefulWidget {
ContainerWidgetPage({Key key}) : super(key: key);
Expand Down
4 changes: 2 additions & 2 deletions example/lib/widgets/icon/widget_icon.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/top_bar.dart';

class IconWidgetPage extends StatefulWidget {
IconWidgetPage({Key key}) : super(key: key);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

class IndeterminateProgressWidgetPage extends StatefulWidget {
IndeterminateProgressWidgetPage({Key key}) : super(key: key);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/widgets/indicator/widget_indicator.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

import 'dart:math' show Random;

Expand Down
6 changes: 3 additions & 3 deletions example/lib/widgets/progress/widget_progress.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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 '../../lib/Code.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

import 'dart:math' show Random;

Expand Down
6 changes: 3 additions & 3 deletions example/lib/widgets/radiobutton/widget_radio_button.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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';
import '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/top_bar.dart';

class RadioButtonWidgetPage extends StatefulWidget {
RadioButtonWidgetPage({Key key}) : super(key: key);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/widgets/range_slider/widget_range_slider.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

class RangeSliderWidgetPage extends StatefulWidget {
RangeSliderWidgetPage({Key key}) : super(key: key);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/widgets/slider/widget_slider.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

class SliderWidgetPage extends StatefulWidget {
SliderWidgetPage({Key key}) : super(key: key);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/widgets/switch/widget_switch.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/color_selector.dart';
import '../../lib/top_bar.dart';

class SwitchWidgetPage extends StatefulWidget {
SwitchWidgetPage({Key key}) : super(key: key);
Expand Down
6 changes: 3 additions & 3 deletions example/lib/widgets/toggle/widget_toggle.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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';
import '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/top_bar.dart';

class ToggleWidgetPage extends StatefulWidget {
ToggleWidgetPage({Key key}) : super(key: key);
Expand Down
7 changes: 3 additions & 4 deletions example/lib/widgets/widgets_home.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
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 '../lib/top_bar.dart';
import '../widgets/appbar/widget_app_bar.dart';
import '../widgets/toggle/widget_toggle.dart';
import 'background/widget_background.dart';
import 'button/widget_button.dart';
import 'checkbox/widget_checkbox.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description: A new Flutter project.
version: 1.0.0+1

environment:
sdk: ">=2.6.0 <3.0.0"
sdk: ">=2.8.0 <3.0.0"

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/theme/theme.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:ui';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart' show IconTheme, IconThemeData, TextTheme;
import 'package:flutter/material.dart' show IconThemeData, TextTheme;
import 'package:flutter/painting.dart';
import 'package:flutter_neumorphic/src/theme/app_bar.dart';
import 'package:flutter_neumorphic/src/widget/container.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widget/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class NeumorphicAppBarState extends State<NeumorphicAppBar> {
final bool canPop = parentRoute?.canPop ?? false;
final bool useCloseButton =
parentRoute is PageRoute<dynamic> && parentRoute.fullscreenDialog;
final ScaffoldState scaffold = Scaffold.maybeOf(context);
final ScaffoldState scaffold = Scaffold.of(context, nullOk: true);
final bool hasDrawer = scaffold?.hasDrawer ?? false;
final bool hasEndDrawer = scaffold?.hasEndDrawer ?? false;

Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ homepage: https://github.com/Idean/Flutter-Neumorphic
issue_tracker: https://github.com/Idean/Flutter-Neumorphic/issues

environment:
sdk: ">=2.1.0 <3.0.0"
flutter: ">=1.13.18 <2.0.0"
sdk: ">=2.8.0 <3.0.0"

dependencies:
flutter:
Expand Down