Skip to content

Commit

Permalink
Analysis improvements and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Oct 6, 2022
1 parent 6bdc4f8 commit 68008b5
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 59 deletions.
26 changes: 1 addition & 25 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
avoid_print: false # Uncomment to disable the `avoid_print` rule
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
require_trailing_commas: true
use_super_parameters: true

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
use_super_parameters: true
2 changes: 2 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ linter:
rules:
prefer_const_constructors: false
prefer_const_literals_to_create_immutables: false
require_trailing_commas: true
use_super_parameters: true

6 changes: 3 additions & 3 deletions example/lib/example_page_items.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final examplePageItems = <YaruPageItem>[
itemWidget: SizedBox(
height: 20,
child: YaruCircularProgressIndicator(strokeWidth: 2),
)),
),),
YaruPageItem(
titleBuilder: (context) => YaruPageItemTitle.text('YaruProgressIndicator'),
iconData: YaruIcons.download,
Expand Down Expand Up @@ -71,11 +71,11 @@ final examplePageItems = <YaruPageItem>[
YaruPageItem(
titleBuilder: (context) => YaruPageItemTitle.text('YaruTabbedPage'),
builder: (_) => TabbedPagePage(),
iconData: YaruIcons.tab_new),
iconData: YaruIcons.tab_new,),
YaruPageItem(
titleBuilder: (context) => YaruPageItemTitle.text('YaruCarousel'),
builder: (_) => CarouselPage(),
iconData: YaruIcons.refresh),
iconData: YaruIcons.refresh,),
YaruPageItem(
titleBuilder: (context) => YaruPageItemTitle.text('YaruColorDisk'),
builder: (context) => ColorDiskPage(),
Expand Down
10 changes: 4 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ void main() {
ChangeNotifierProvider(create: (_) => DarkTheme(yaruDark)),
],
child: Home(),
));
),);
}

class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
const Home({super.key});

@override
State<Home> createState() => _HomeState();
Expand Down Expand Up @@ -63,7 +63,7 @@ class _HomeState extends State<Home> {
],
),
)
]),
],),
iconData: YaruIcons.settings,
);

Expand Down Expand Up @@ -91,11 +91,9 @@ class _HomeState extends State<Home> {

class _CompactPage extends StatelessWidget {
const _CompactPage({
Key? key,
required this.configItem,
required int amount,
}) : _amount = amount,
super(key: key);
}) : _amount = amount;

final YaruPageItem configItem;
final int _amount;
Expand Down
16 changes: 8 additions & 8 deletions example/lib/pages/carousel_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:yaru_icons/yaru_icons.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class CarouselPage extends StatefulWidget {
const CarouselPage({Key? key}) : super(key: key);
const CarouselPage({super.key});

@override
_CarouselPageState createState() => _CarouselPageState();
Expand All @@ -26,7 +26,7 @@ class _CarouselPageState extends State<CarouselPage> {
previousIcon: Icon(YaruIcons.go_previous),
nextIcon: Icon(YaruIcons.go_next),
),
]),
],),
YaruSection(headline: 'Auto scroll: on', width: 700, children: [
YaruCarousel(
controller: YaruCarouselController(
Expand All @@ -36,26 +36,26 @@ class _CarouselPageState extends State<CarouselPage> {
children: _getCarouselChildren(),
height: 400,
),
]),
],),
ButtonBar(
buttonPadding: EdgeInsets.zero,
children: [
YaruOptionButton(
onPressed: () => setState(() {
length++;
}),
child: Icon(YaruIcons.plus)),
child: Icon(YaruIcons.plus),),
SizedBox(
width: 10,
),
YaruOptionButton(
onPressed: () => setState(() {
length >= 2 ? length-- : length = length;
}),
child: Icon(YaruIcons.minus))
child: Icon(YaruIcons.minus),)
],
)
]);
],);
}

List<Widget> _getCarouselChildren() {
Expand All @@ -65,9 +65,9 @@ class _CarouselPageState extends State<CarouselPage> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.1)),
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.1),),
image: DecorationImage(
fit: BoxFit.contain, image: AssetImage('assets/ubuntuhero.jpg')),
fit: BoxFit.contain, image: AssetImage('assets/ubuntuhero.jpg'),),
),
),
);
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/color_disk_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:yaru_widgets/yaru_widgets.dart';
import 'package:yaru_widgets_example/theme.dart';

class ColorDiskPage extends StatefulWidget {
const ColorDiskPage({Key? key}) : super(key: key);
const ColorDiskPage({super.key});

@override
State<ColorDiskPage> createState() => _ColorDiskPageState();
Expand Down Expand Up @@ -34,7 +34,7 @@ class _ColorDiskPageState extends State<ColorDiskPage> {
],
),
)
]);
],);
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/draggable_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ class DraggablePage extends StatelessWidget {
),
),
)
]);
],);
}
}
2 changes: 1 addition & 1 deletion example/lib/pages/option_button_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:yaru_icons/yaru_icons.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class OptionButtonPage extends StatefulWidget {
const OptionButtonPage({Key? key}) : super(key: key);
const OptionButtonPage({super.key});

@override
_OptionButtonPageState createState() => _OptionButtonPageState();
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/round_toggle_button_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:yaru_icons/yaru_icons.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class RoundToggleButtonPage extends StatefulWidget {
const RoundToggleButtonPage({Key? key}) : super(key: key);
const RoundToggleButtonPage({super.key});

@override
State<RoundToggleButtonPage> createState() => _RoundToggleButtonPageState();
Expand All @@ -22,6 +22,6 @@ class _RoundToggleButtonPageState extends State<RoundToggleButtonPage> {
iconData: YaruIcons.view,
tooltip: 'View',
)
]);
],);
}
}
2 changes: 1 addition & 1 deletion example/lib/pages/section_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:yaru_widgets_example/widgets/tile_list.dart';
const kMinSectionWidth = 400.0;

class SectionPage extends StatefulWidget {
const SectionPage({Key? key}) : super(key: key);
const SectionPage({super.key});

@override
_SectionPageState createState() => _SectionPageState();
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/selectable_container_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:yaru_icons/yaru_icons.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class SelectableContainerPage extends StatefulWidget {
const SelectableContainerPage({Key? key}) : super(key: key);
const SelectableContainerPage({super.key});

@override
State<SelectableContainerPage> createState() =>
Expand All @@ -25,7 +25,7 @@ class _SelectableContainerPageState extends State<SelectableContainerPage> {
maxCrossAxisExtent: 300,
childAspectRatio: 16 / 12,
mainAxisSpacing: 10,
crossAxisSpacing: 10),
crossAxisSpacing: 10,),
children: [
YaruSelectableContainer(
selected: !_isImageSelected,
Expand Down
8 changes: 4 additions & 4 deletions example/lib/pages/tabbed_page_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:yaru_widgets/yaru_widgets.dart';

class TabbedPagePage extends StatefulWidget {
const TabbedPagePage({
Key? key,
}) : super(key: key);
super.key,
});

@override
State<TabbedPagePage> createState() => _TabbedPagePageState();
Expand Down Expand Up @@ -47,7 +47,7 @@ class _TabbedPagePageState extends State<TabbedPagePage> {
headline: 'Accessibility',
children: [Text('accessibility')],
)
]),
],),
YaruPage(children: [Text('Audio')]),
YaruPage(children: [Text('AddressBook')]),
YaruPage(children: [Text('Television')])
Expand All @@ -65,6 +65,6 @@ class _TabbedPagePageState extends State<TabbedPagePage> {
'Audio',
'Address Book',
'Television'
]);
],);
}
}
4 changes: 2 additions & 2 deletions example/lib/theme.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';

class LightTheme extends ValueNotifier<ThemeData> {
LightTheme(ThemeData value) : super(value);
LightTheme(super.value);
}

class DarkTheme extends ValueNotifier<ThemeData> {
DarkTheme(ThemeData value) : super(value);
DarkTheme(super.value);
}
2 changes: 1 addition & 1 deletion example/lib/widgets/dummy_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:yaru_widgets/yaru_widgets.dart';
class DummySection extends StatelessWidget {
final double? width;

const DummySection({Key? key, this.width}) : super(key: key);
const DummySection({super.key, this.width});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widgets/tile_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:yaru_icons/yaru_icons.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class TileList extends StatelessWidget {
const TileList({Key? key}) : super(key: key);
const TileList({super.key});

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit 68008b5

Please sign in to comment.