lots of dart formats

pull/2701/head
Eric Windmill 1 month ago
parent 204606a39e
commit 04e6e73b26

@ -24,8 +24,7 @@ class Book {
pigeonMap['summary'] = summary; pigeonMap['summary'] = summary;
pigeonMap['publishDate'] = publishDate; pigeonMap['publishDate'] = publishDate;
pigeonMap['pageCount'] = pageCount; pigeonMap['pageCount'] = pageCount;
pigeonMap['thumbnail'] = pigeonMap['thumbnail'] = thumbnail == null ? null : thumbnail!.encode();
thumbnail == null ? null : thumbnail!.encode();
return pigeonMap; return pigeonMap;
} }
@ -168,10 +167,9 @@ class HostBookApi {
} }
Future<void> finishEditingBook(Book arg_book) async { Future<void> finishEditingBook(Book arg_book) async {
final BasicMessageChannel<Object?> channel = final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
BasicMessageChannel<Object?>( 'dev.flutter.pigeon.HostBookApi.finishEditingBook', codec,
'dev.flutter.pigeon.HostBookApi.finishEditingBook', codec, binaryMessenger: _binaryMessenger);
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = final Map<Object?, Object?>? replyMap =
await channel.send(<Object>[arg_book]) as Map<Object?, Object?>?; await channel.send(<Object>[arg_book]) as Map<Object?, Object?>?;
if (replyMap == null) { if (replyMap == null) {

@ -15,8 +15,7 @@ class AnimatedContainerDemo extends StatefulWidget {
static String routeName = 'basics/animated_container'; static String routeName = 'basics/animated_container';
@override @override
State<AnimatedContainerDemo> createState() => State<AnimatedContainerDemo> createState() => _AnimatedContainerDemoState();
_AnimatedContainerDemoState();
} }
class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> { class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {

@ -27,8 +27,7 @@ class AnimatedSwitcherDemo extends StatefulWidget {
static String routeName = 'misc/animated_switcher'; static String routeName = 'misc/animated_switcher';
@override @override
State<AnimatedSwitcherDemo> createState() => State<AnimatedSwitcherDemo> createState() => _AnimatedSwitcherDemoState();
_AnimatedSwitcherDemoState();
} }
class _AnimatedSwitcherDemoState extends State<AnimatedSwitcherDemo> { class _AnimatedSwitcherDemoState extends State<AnimatedSwitcherDemo> {

@ -174,8 +174,7 @@ class _SwipeableCardState extends State<SwipeableCard>
return; return;
} }
var velocity = (details.velocity.pixelsPerSecond.dx / size.width) var velocity = (details.velocity.pixelsPerSecond.dx / size.width).abs();
.abs();
_animate(velocity: velocity); _animate(velocity: velocity);
} }

@ -123,8 +123,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
if (newCurve != null) { if (newCurve != null) {
setState(() { setState(() {
selectedReverseCurve = newCurve; selectedReverseCurve = newCurve;
curvedAnimation.reverseCurve = curvedAnimation.reverseCurve = selectedReverseCurve.curve;
selectedReverseCurve.curve;
}); });
} }
}, },

@ -56,8 +56,7 @@ void main() {
// Check that the color has changed to the final color. // Check that the color has changed to the final color.
button = tester.widget(find.byType(ElevatedButton)); button = tester.widget(find.byType(ElevatedButton));
WidgetStateProperty<Color?>? finalColor = WidgetStateProperty<Color?>? finalColor = button.style!.backgroundColor;
button.style!.backgroundColor;
expect(changedColor, isNot(finalColor)); expect(changedColor, isNot(finalColor));
}); });
}); });

@ -46,9 +46,7 @@ void main() {
await tester.pumpWidget(createAnimatedListDemoScreen()); await tester.pumpWidget(createAnimatedListDemoScreen());
// Get the initial length of list. // Get the initial length of list.
var initialLength = tester var initialLength = tester.widgetList(find.byType(ListTile)).length;
.widgetList(find.byType(ListTile))
.length;
// Tap on the Delete Icon Button at middle index. // Tap on the Delete Icon Button at middle index.
await tester.tap(find.byIcon(Icons.delete).at(initialLength ~/ 2)); await tester.tap(find.byIcon(Icons.delete).at(initialLength ~/ 2));
@ -68,9 +66,7 @@ void main() {
await tester.pumpWidget(createAnimatedListDemoScreen()); await tester.pumpWidget(createAnimatedListDemoScreen());
// Get the initial length of list. // Get the initial length of list.
var initialLength = tester var initialLength = tester.widgetList(find.byType(ListTile)).length;
.widgetList(find.byType(ListTile))
.length;
// Tap on the Delete Icon Button at start index. // Tap on the Delete Icon Button at start index.
await tester.tap(find.byIcon(Icons.delete).at(0)); await tester.tap(find.byIcon(Icons.delete).at(0));
@ -90,9 +86,7 @@ void main() {
await tester.pumpWidget(createAnimatedListDemoScreen()); await tester.pumpWidget(createAnimatedListDemoScreen());
// Get the initial length of list. // Get the initial length of list.
var initialLength = tester var initialLength = tester.widgetList(find.byType(ListTile)).length;
.widgetList(find.byType(ListTile))
.length;
// Tap on the Delete Icon Button at end index. // Tap on the Delete Icon Button at end index.
await tester.tap(find.byIcon(Icons.delete).at(initialLength - 1)); await tester.tap(find.byIcon(Icons.delete).at(initialLength - 1));

@ -6,8 +6,7 @@ import 'package:animations/src/misc/expand_card.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
Widget createExpandCardScreen() => Widget createExpandCardScreen() => const MaterialApp(home: ExpandCardDemo());
const MaterialApp(home: ExpandCardDemo());
void main() { void main() {
group('ExpandCard Tests', () { group('ExpandCard Tests', () {

@ -6,8 +6,7 @@ import 'package:animations/src/misc/focus_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
Widget createFocusImageScreen() => Widget createFocusImageScreen() => const MaterialApp(home: FocusImageDemo());
const MaterialApp(home: FocusImageDemo());
void main() { void main() {
group('FocusImage Tests', () { group('FocusImage Tests', () {

@ -65,10 +65,9 @@ class _MyHomePageState extends State<MyHomePage> {
// Write the value to [SharedPreferences] which will get read on the // Write the value to [SharedPreferences] which will get read on the
// [SimpleDatabase]'s isolate. For this example the value is always true // [SimpleDatabase]'s isolate. For this example the value is always true
// just for demonstration purposes. // just for demonstration purposes.
final Future<void> sharedPreferencesSet = final Future<void> sharedPreferencesSet = SharedPreferences.getInstance()
SharedPreferences.getInstance().then( .then(
(sharedPreferences) => (sharedPreferences) => sharedPreferences.setBool('isDebug', true),
sharedPreferences.setBool('isDebug', true),
); );
final Future<Directory> tempDirFuture = path_provider final Future<Directory> tempDirFuture = path_provider
.getTemporaryDirectory(); .getTemporaryDirectory();

@ -181,8 +181,7 @@ class _SimpleDatabaseServer {
// obtained on the root isolate and passed into the background isolate via // obtained on the root isolate and passed into the background isolate via
// a [SendPort]. // a [SendPort].
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
RootIsolateToken rootIsolateToken = RootIsolateToken rootIsolateToken = command.arg1 as RootIsolateToken;
command.arg1 as RootIsolateToken;
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// [BackgroundIsolateBinaryMessenger.ensureInitialized] for each // [BackgroundIsolateBinaryMessenger.ensureInitialized] for each
// background isolate that will use plugins. This sets up the // background isolate that will use plugins. This sets up the

@ -112,9 +112,7 @@ class _MyContextMenuRegionState extends State<_MyContextMenuRegion> {
), ),
), ),
Text( Text(
_lastSelection != null _lastSelection != null ? 'Last Selected: $_lastSelection' : '',
? 'Last Selected: $_lastSelection'
: '',
), ),
], ],
), ),

@ -28,8 +28,7 @@ class ContextMenuRegion extends StatefulWidget {
class _ContextMenuRegionState extends State<ContextMenuRegion> { class _ContextMenuRegionState extends State<ContextMenuRegion> {
Offset? _longPressOffset; Offset? _longPressOffset;
final ContextMenuController _contextMenuController = final ContextMenuController _contextMenuController = ContextMenuController();
ContextMenuController();
static bool get _longPressEnabled { static bool get _longPressEnabled {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {

@ -34,8 +34,7 @@ class FieldTypesPage extends StatelessWidget {
final TextEditingController final TextEditingController
_cupertinoControllerForced = TextEditingController( _cupertinoControllerForced = TextEditingController(
text: text: 'Or forced to always show a specific menu (Material desktop menu).',
'Or forced to always show a specific menu (Material desktop menu).',
); );
final TextEditingController _editableController = TextEditingController( final TextEditingController _editableController = TextEditingController(
@ -88,13 +87,11 @@ class FieldTypesPage extends StatelessWidget {
controller: _cupertinoControllerForced, controller: _cupertinoControllerForced,
contextMenuBuilder: (context, editableTextState) { contextMenuBuilder: (context, editableTextState) {
return DesktopTextSelectionToolbar( return DesktopTextSelectionToolbar(
anchor: anchor: editableTextState.contextMenuAnchors.primaryAnchor,
editableTextState.contextMenuAnchors.primaryAnchor, children: AdaptiveTextSelectionToolbar.getAdaptiveButtons(
children: context,
AdaptiveTextSelectionToolbar.getAdaptiveButtons( editableTextState.contextMenuButtonItems,
context, ).toList(),
editableTextState.contextMenuButtonItems,
).toList(),
); );
}, },
), ),

@ -13,8 +13,7 @@ class PlatformSelector extends StatefulWidget {
} }
class _PlatformSelectorState extends State<PlatformSelector> { class _PlatformSelectorState extends State<PlatformSelector> {
static const int targetPlatformStringLength = static const int targetPlatformStringLength = 15; // 'TargetPlatform.'.length
15; // 'TargetPlatform.'.length
static String _platformToString(TargetPlatform platform) { static String _platformToString(TargetPlatform platform) {
return platform.toString().substring(targetPlatformStringLength); return platform.toString().substring(targetPlatformStringLength);

@ -55,15 +55,9 @@ class ReorderedButtonsPage extends StatelessWidget {
maxLines: 2, maxLines: 2,
contextMenuBuilder: (context, editableTextState) { contextMenuBuilder: (context, editableTextState) {
// Reorder the button datas by type. // Reorder the button datas by type.
final HashMap< final HashMap<ContextMenuButtonType, ContextMenuButtonItem>
ContextMenuButtonType,
ContextMenuButtonItem
>
buttonItemsMap = buttonItemsMap =
HashMap< HashMap<ContextMenuButtonType, ContextMenuButtonItem>();
ContextMenuButtonType,
ContextMenuButtonItem
>();
for (ContextMenuButtonItem buttonItem for (ContextMenuButtonItem buttonItem
in editableTextState.contextMenuButtonItems) { in editableTextState.contextMenuButtonItems) {
buttonItemsMap[buttonItem.type] = buttonItem; buttonItemsMap[buttonItem.type] = buttonItem;

@ -106,9 +106,7 @@ class _$Search extends Search {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if (identical(other, this)) return true; if (identical(other, this)) return true;
return other is Search && return other is Search && query == other.query && results == other.results;
query == other.query &&
results == other.results;
} }
@override @override

@ -12,8 +12,7 @@ import '../serializers.dart';
part 'current_user_collections.g.dart'; part 'current_user_collections.g.dart';
abstract class CurrentUserCollections abstract class CurrentUserCollections
implements implements Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
factory CurrentUserCollections([ factory CurrentUserCollections([
void Function(CurrentUserCollectionsBuilder)? updates, void Function(CurrentUserCollectionsBuilder)? updates,
]) = _$CurrentUserCollections; ]) = _$CurrentUserCollections;

@ -192,8 +192,7 @@ class _$CurrentUserCollections extends CurrentUserCollections {
} }
class CurrentUserCollectionsBuilder class CurrentUserCollectionsBuilder
implements implements Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
_$CurrentUserCollections? _$v; _$CurrentUserCollections? _$v;
int? _id; int? _id;
@ -206,8 +205,7 @@ class CurrentUserCollectionsBuilder
String? _publishedAt; String? _publishedAt;
String? get publishedAt => _$this._publishedAt; String? get publishedAt => _$this._publishedAt;
set publishedAt(String? publishedAt) => set publishedAt(String? publishedAt) => _$this._publishedAt = publishedAt;
_$this._publishedAt = publishedAt;
String? _updatedAt; String? _updatedAt;
String? get updatedAt => _$this._updatedAt; String? get updatedAt => _$this._updatedAt;

@ -254,8 +254,7 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
String? _focalLength; String? _focalLength;
String? get focalLength => _$this._focalLength; String? get focalLength => _$this._focalLength;
set focalLength(String? focalLength) => set focalLength(String? focalLength) => _$this._focalLength = focalLength;
_$this._focalLength = focalLength;
int? _iso; int? _iso;
int? get iso => _$this._iso; int? get iso => _$this._iso;

@ -169,8 +169,7 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
set country(String? country) => _$this._country = country; set country(String? country) => _$this._country = country;
PositionBuilder? _position; PositionBuilder? _position;
PositionBuilder get position => PositionBuilder get position => _$this._position ??= new PositionBuilder();
_$this._position ??= new PositionBuilder();
set position(PositionBuilder? position) => _$this._position = position; set position(PositionBuilder? position) => _$this._position = position;
LocationBuilder(); LocationBuilder();

@ -551,16 +551,14 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
String? _description; String? _description;
String? get description => _$this._description; String? get description => _$this._description;
set description(String? description) => set description(String? description) => _$this._description = description;
_$this._description = description;
ExifBuilder? _exif; ExifBuilder? _exif;
ExifBuilder get exif => _$this._exif ??= new ExifBuilder(); ExifBuilder get exif => _$this._exif ??= new ExifBuilder();
set exif(ExifBuilder? exif) => _$this._exif = exif; set exif(ExifBuilder? exif) => _$this._exif = exif;
LocationBuilder? _location; LocationBuilder? _location;
LocationBuilder get location => LocationBuilder get location => _$this._location ??= new LocationBuilder();
_$this._location ??= new LocationBuilder();
set location(LocationBuilder? location) => _$this._location = location; set location(LocationBuilder? location) => _$this._location = location;
ListBuilder<Tags>? _tags; ListBuilder<Tags>? _tags;

@ -86,8 +86,7 @@ class _$Position extends Position {
factory _$Position([void Function(PositionBuilder)? updates]) => factory _$Position([void Function(PositionBuilder)? updates]) =>
(new PositionBuilder()..update(updates))._build(); (new PositionBuilder()..update(updates))._build();
_$Position._({required this.latitude, required this.longitude}) _$Position._({required this.latitude, required this.longitude}) : super._() {
: super._() {
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
latitude, latitude,
r'Position', r'Position',

@ -115,9 +115,7 @@ class _SplitState extends State<Split> {
secondSize = secondSize - halfDivider; secondSize = secondSize - halfDivider;
void updateSpacing(DragUpdateDetails dragDetails) { void updateSpacing(DragUpdateDetails dragDetails) {
final delta = isHorizontal final delta = isHorizontal ? dragDetails.delta.dx : dragDetails.delta.dy;
? dragDetails.delta.dx
: dragDetails.delta.dy;
final fractionalDelta = delta / axisSize; final fractionalDelta = delta / axisSize;
setState(() { setState(() {
// Update the fraction of space consumed by the children, // Update the fraction of space consumed by the children,
@ -151,12 +149,8 @@ class _SplitState extends State<Split> {
), ),
), ),
child: SizedBox( child: SizedBox(
height: isHorizontal height: isHorizontal ? 2.0 : Split.dividerMainAxisSize - 2.0,
? 2.0 width: isHorizontal ? Split.dividerMainAxisSize - 2.0 : 2.0,
: Split.dividerMainAxisSize - 2.0,
width: isHorizontal
? Split.dividerMainAxisSize - 2.0
: 2.0,
), ),
), ),
), ),

@ -15,8 +15,7 @@ class UnsplashSearchContent extends StatefulWidget {
const UnsplashSearchContent({super.key}); const UnsplashSearchContent({super.key});
@override @override
State<UnsplashSearchContent> createState() => State<UnsplashSearchContent> createState() => _UnsplashSearchContentState();
_UnsplashSearchContentState();
} }
class _UnsplashSearchContentState extends State<UnsplashSearchContent> { class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
@ -40,9 +39,7 @@ class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
child: SingleChildScrollView( child: SingleChildScrollView(
controller: _treeViewScrollController, controller: _treeViewScrollController,
child: TreeView( child: TreeView(
items: photoSearchModel.entries items: photoSearchModel.entries.map(_buildSearchEntry).toList(),
.map(_buildSearchEntry)
.toList(),
), ),
), ),
), ),

@ -44,8 +44,7 @@ Future<void> test() async =>
_logProcessOutput(Process.start('flutter', ['test'])); _logProcessOutput(Process.start('flutter', ['test']));
@Task() @Task()
Future<void> clean() => Future<void> clean() => _logProcessOutput(Process.start('flutter', ['clean']));
_logProcessOutput(Process.start('flutter', ['clean']));
Future<void> _logProcessOutput(Future<Process> proc) async { Future<void> _logProcessOutput(Future<Process> proc) async {
final process = await proc; final process = await proc;

@ -106,9 +106,7 @@ class _$Search extends Search {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if (identical(other, this)) return true; if (identical(other, this)) return true;
return other is Search && return other is Search && query == other.query && results == other.results;
query == other.query &&
results == other.results;
} }
@override @override

@ -12,8 +12,7 @@ import '../serializers.dart';
part 'current_user_collections.g.dart'; part 'current_user_collections.g.dart';
abstract class CurrentUserCollections abstract class CurrentUserCollections
implements implements Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
factory CurrentUserCollections([ factory CurrentUserCollections([
void Function(CurrentUserCollectionsBuilder)? updates, void Function(CurrentUserCollectionsBuilder)? updates,
]) = _$CurrentUserCollections; ]) = _$CurrentUserCollections;

@ -192,8 +192,7 @@ class _$CurrentUserCollections extends CurrentUserCollections {
} }
class CurrentUserCollectionsBuilder class CurrentUserCollectionsBuilder
implements implements Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
_$CurrentUserCollections? _$v; _$CurrentUserCollections? _$v;
int? _id; int? _id;
@ -206,8 +205,7 @@ class CurrentUserCollectionsBuilder
String? _publishedAt; String? _publishedAt;
String? get publishedAt => _$this._publishedAt; String? get publishedAt => _$this._publishedAt;
set publishedAt(String? publishedAt) => set publishedAt(String? publishedAt) => _$this._publishedAt = publishedAt;
_$this._publishedAt = publishedAt;
String? _updatedAt; String? _updatedAt;
String? get updatedAt => _$this._updatedAt; String? get updatedAt => _$this._updatedAt;

@ -254,8 +254,7 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
String? _focalLength; String? _focalLength;
String? get focalLength => _$this._focalLength; String? get focalLength => _$this._focalLength;
set focalLength(String? focalLength) => set focalLength(String? focalLength) => _$this._focalLength = focalLength;
_$this._focalLength = focalLength;
int? _iso; int? _iso;
int? get iso => _$this._iso; int? get iso => _$this._iso;

@ -169,8 +169,7 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
set country(String? country) => _$this._country = country; set country(String? country) => _$this._country = country;
PositionBuilder? _position; PositionBuilder? _position;
PositionBuilder get position => PositionBuilder get position => _$this._position ??= new PositionBuilder();
_$this._position ??= new PositionBuilder();
set position(PositionBuilder? position) => _$this._position = position; set position(PositionBuilder? position) => _$this._position = position;
LocationBuilder(); LocationBuilder();

@ -551,16 +551,14 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
String? _description; String? _description;
String? get description => _$this._description; String? get description => _$this._description;
set description(String? description) => set description(String? description) => _$this._description = description;
_$this._description = description;
ExifBuilder? _exif; ExifBuilder? _exif;
ExifBuilder get exif => _$this._exif ??= new ExifBuilder(); ExifBuilder get exif => _$this._exif ??= new ExifBuilder();
set exif(ExifBuilder? exif) => _$this._exif = exif; set exif(ExifBuilder? exif) => _$this._exif = exif;
LocationBuilder? _location; LocationBuilder? _location;
LocationBuilder get location => LocationBuilder get location => _$this._location ??= new LocationBuilder();
_$this._location ??= new LocationBuilder();
set location(LocationBuilder? location) => _$this._location = location; set location(LocationBuilder? location) => _$this._location = location;
ListBuilder<Tags>? _tags; ListBuilder<Tags>? _tags;

@ -86,8 +86,7 @@ class _$Position extends Position {
factory _$Position([void Function(PositionBuilder)? updates]) => factory _$Position([void Function(PositionBuilder)? updates]) =>
(new PositionBuilder()..update(updates))._build(); (new PositionBuilder()..update(updates))._build();
_$Position._({required this.latitude, required this.longitude}) _$Position._({required this.latitude, required this.longitude}) : super._() {
: super._() {
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
latitude, latitude,
r'Position', r'Position',

@ -115,9 +115,7 @@ class _SplitState extends State<Split> {
secondSize = secondSize - halfDivider; secondSize = secondSize - halfDivider;
void updateSpacing(DragUpdateDetails dragDetails) { void updateSpacing(DragUpdateDetails dragDetails) {
final delta = isHorizontal final delta = isHorizontal ? dragDetails.delta.dx : dragDetails.delta.dy;
? dragDetails.delta.dx
: dragDetails.delta.dy;
final fractionalDelta = delta / axisSize; final fractionalDelta = delta / axisSize;
setState(() { setState(() {
// Update the fraction of space consumed by the children, // Update the fraction of space consumed by the children,
@ -151,12 +149,8 @@ class _SplitState extends State<Split> {
), ),
), ),
child: SizedBox( child: SizedBox(
height: isHorizontal height: isHorizontal ? 2.0 : Split.dividerMainAxisSize - 2.0,
? 2.0 width: isHorizontal ? Split.dividerMainAxisSize - 2.0 : 2.0,
: Split.dividerMainAxisSize - 2.0,
width: isHorizontal
? Split.dividerMainAxisSize - 2.0
: 2.0,
), ),
), ),
), ),

@ -16,8 +16,7 @@ class UnsplashSearchContent extends StatefulWidget {
const UnsplashSearchContent({super.key}); const UnsplashSearchContent({super.key});
@override @override
State<UnsplashSearchContent> createState() => State<UnsplashSearchContent> createState() => _UnsplashSearchContentState();
_UnsplashSearchContentState();
} }
class _UnsplashSearchContentState extends State<UnsplashSearchContent> { class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
@ -41,9 +40,7 @@ class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
child: SingleChildScrollView( child: SingleChildScrollView(
controller: _treeViewScrollController, controller: _treeViewScrollController,
child: TreeView( child: TreeView(
nodes: photoSearchModel.entries nodes: photoSearchModel.entries.map(_buildSearchEntry).toList(),
.map(_buildSearchEntry)
.toList(),
indent: 0, indent: 0,
), ),
), ),

@ -44,8 +44,7 @@ Future<void> test() async =>
_logProcessOutput(Process.start('flutter', ['test'])); _logProcessOutput(Process.start('flutter', ['test']));
@Task() @Task()
Future<void> clean() => Future<void> clean() => _logProcessOutput(Process.start('flutter', ['clean']));
_logProcessOutput(Process.start('flutter', ['clean']));
Future<void> _logProcessOutput(Future<Process> proc) async { Future<void> _logProcessOutput(Future<Process> proc) async {
final process = await proc; final process = await proc;

@ -131,8 +131,7 @@ class _FormWidgetsDemoState extends State<FormWidgetsDemo> {
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(

@ -13,8 +13,7 @@ FormData _$FormDataFromJson(Map<String, dynamic> json) {
); );
} }
Map<String, dynamic> _$FormDataToJson(FormData instance) => Map<String, dynamic> _$FormDataToJson(FormData instance) => <String, dynamic>{
<String, dynamic>{ 'email': instance.email,
'email': instance.email, 'password': instance.password,
'password': instance.password, };
};

@ -27,8 +27,7 @@ part 'locations.g.dart';
class LatLng { class LatLng {
LatLng({required this.lat, required this.lng}); LatLng({required this.lat, required this.lng});
factory LatLng.fromJson(Map<String, dynamic> json) => factory LatLng.fromJson(Map<String, dynamic> json) => _$LatLngFromJson(json);
_$LatLngFromJson(json);
Map<String, dynamic> toJson() => _$LatLngToJson(this); Map<String, dynamic> toJson() => _$LatLngToJson(this);
final double lat; final double lat;
@ -44,8 +43,7 @@ class Region {
required this.zoom, required this.zoom,
}); });
factory Region.fromJson(Map<String, dynamic> json) => factory Region.fromJson(Map<String, dynamic> json) => _$RegionFromJson(json);
_$RegionFromJson(json);
Map<String, dynamic> toJson() => _$RegionToJson(this); Map<String, dynamic> toJson() => _$RegionToJson(this);
final LatLng coords; final LatLng coords;
@ -67,8 +65,7 @@ class Office {
required this.region, required this.region,
}); });
factory Office.fromJson(Map<String, dynamic> json) => factory Office.fromJson(Map<String, dynamic> json) => _$OfficeFromJson(json);
_$OfficeFromJson(json);
Map<String, dynamic> toJson() => _$OfficeToJson(this); Map<String, dynamic> toJson() => _$OfficeToJson(this);
final String address; final String address;
@ -94,8 +91,7 @@ class Locations {
} }
Future<Locations> getGoogleOffices() async { Future<Locations> getGoogleOffices() async {
const googleLocationsURL = const googleLocationsURL = 'https://about.google/static/data/locations.json';
'https://about.google/static/data/locations.json';
// Retrieve the locations of Google offices // Retrieve the locations of Google offices
try { try {

@ -72,10 +72,9 @@ class _PerformancePageState extends State<PerformancePage> {
return ElevatedButton( return ElevatedButton(
style: ElevatedButton.styleFrom(elevation: 8.0), style: ElevatedButton.styleFrom(elevation: 8.0),
onPressed: switch (snapshot.connectionState) { onPressed: switch (snapshot.connectionState) {
ConnectionState.done => ConnectionState.done => () => handleComputeOnSecondary(
() => handleComputeOnSecondary( context,
context, ),
),
_ => null, _ => null,
}, },
child: const Text('Compute on Secondary'), child: const Text('Compute on Secondary'),
@ -136,8 +135,7 @@ class SmoothAnimationWidget extends StatefulWidget {
const SmoothAnimationWidget({super.key}); const SmoothAnimationWidget({super.key});
@override @override
State<SmoothAnimationWidget> createState() => State<SmoothAnimationWidget> createState() => _SmoothAnimationWidgetState();
_SmoothAnimationWidgetState();
} }
class _SmoothAnimationWidgetState extends State<SmoothAnimationWidget> class _SmoothAnimationWidgetState extends State<SmoothAnimationWidget>

@ -24,8 +24,7 @@ class _AppState extends State<App> {
ColorSeed _colorSelected = ColorSeed.baseColor; ColorSeed _colorSelected = ColorSeed.baseColor;
ColorImageProvider _imageSelected = ColorImageProvider.leaves; ColorImageProvider _imageSelected = ColorImageProvider.leaves;
ColorScheme? _imageColorScheme = const ColorScheme.light(); ColorScheme? _imageColorScheme = const ColorScheme.light();
ColorSelectionMethod _colorSelectionMethod = ColorSelectionMethod _colorSelectionMethod = ColorSelectionMethod.colorSeed;
ColorSelectionMethod.colorSeed;
bool get _useLightMode => switch (_themeMode) { bool get _useLightMode => switch (_themeMode) {
ThemeMode.system => ThemeMode.system =>

@ -93,8 +93,7 @@ class ColorSeedButton extends StatelessWidget {
padding: const EdgeInsets.only(left: 10), padding: const EdgeInsets.only(left: 10),
child: Icon( child: Icon(
currentColor == colorSelected && currentColor == colorSelected &&
colorSelectionMethod != colorSelectionMethod != ColorSelectionMethod.image
ColorSelectionMethod.image
? Icons.color_lens ? Icons.color_lens
: Icons.color_lens_outlined, : Icons.color_lens_outlined,
color: currentColor.color, color: currentColor.color,

@ -593,8 +593,7 @@ class TextFields extends StatefulWidget {
class _TextFieldsState extends State<TextFields> { class _TextFieldsState extends State<TextFields> {
final TextEditingController _controllerFilled = TextEditingController(); final TextEditingController _controllerFilled = TextEditingController();
final TextEditingController _controllerOutlined = final TextEditingController _controllerOutlined = TextEditingController();
TextEditingController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -1938,8 +1937,7 @@ class NavigationDrawerSection extends StatefulWidget {
_NavigationDrawerSectionState(); _NavigationDrawerSectionState();
} }
class _NavigationDrawerSectionState class _NavigationDrawerSectionState extends State<NavigationDrawerSection> {
extends State<NavigationDrawerSection> {
int navDrawerIndex = 0; int navDrawerIndex = 0;
@override @override
@ -2054,8 +2052,7 @@ class NavigationRailSection extends StatefulWidget {
const NavigationRailSection({super.key}); const NavigationRailSection({super.key});
@override @override
State<NavigationRailSection> createState() => State<NavigationRailSection> createState() => _NavigationRailSectionState();
_NavigationRailSectionState();
} }
class _NavigationRailSectionState extends State<NavigationRailSection> { class _NavigationRailSectionState extends State<NavigationRailSection> {

@ -222,8 +222,7 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
child: showLargeSizeLayout child: showLargeSizeLayout
? ExpandedTrailingActions( ? ExpandedTrailingActions(
useLightMode: widget.useLightMode, useLightMode: widget.useLightMode,
handleBrightnessChange: handleBrightnessChange: widget.handleBrightnessChange,
widget.handleBrightnessChange,
useMaterial3: widget.useMaterial3, useMaterial3: widget.useMaterial3,
handleMaterialVersionChange: handleMaterialVersionChange:
widget.handleMaterialVersionChange, widget.handleMaterialVersionChange,
@ -253,19 +252,18 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
} }
} }
final List<NavigationRailDestination> _navRailDestinations = final List<NavigationRailDestination> _navRailDestinations = appBarDestinations
appBarDestinations .map(
.map( (destination) => NavigationRailDestination(
(destination) => NavigationRailDestination( icon: Tooltip(
icon: Tooltip( message: destination.label,
message: destination.label, child: destination.icon,
child: destination.icon, ),
), selectedIcon: Tooltip(
selectedIcon: Tooltip( message: destination.label,
message: destination.label, child: destination.selectedIcon,
child: destination.selectedIcon, ),
), label: Text(destination.label),
label: Text(destination.label), ),
), )
) .toList(growable: false);
.toList(growable: false);

@ -29,8 +29,7 @@ class NavigationTransition extends StatefulWidget {
final Widget body; final Widget body;
@override @override
State<NavigationTransition> createState() => State<NavigationTransition> createState() => _NavigationTransitionState();
_NavigationTransitionState();
} }
class _NavigationTransitionState extends State<NavigationTransition> { class _NavigationTransitionState extends State<NavigationTransition> {

@ -8,14 +8,15 @@ Future<void> main() async {
final pubspecContent = await pubspecFile.readAsString(); final pubspecContent = await pubspecFile.readAsString();
final pubspecYaml = loadYaml(pubspecContent); final pubspecYaml = loadYaml(pubspecContent);
// pub workspace, only run 'get' once
final workspace = pubspecYaml['workspace'] as YamlList?; final workspace = pubspecYaml['workspace'] as YamlList?;
await _runCommand('flutter', ['pub', 'get']);
if (workspace == null) { if (workspace == null) {
print('No workspace found in pubspec.yaml'); print('No workspace found in pubspec.yaml');
exit(1); exit(1);
} }
// pub workspace, only run 'get' once
await _runCommand('flutter', ['pub', 'get'], workingDirectory: './');
final packages = workspace.map((e) => e.toString()).toList(); final packages = workspace.map((e) => e.toString()).toList();
for (final package in packages) { for (final package in packages) {
@ -26,18 +27,17 @@ Future<void> main() async {
'--fatal-infos', '--fatal-infos',
'--fatal-warnings', '--fatal-warnings',
], workingDirectory: packagePath); ], workingDirectory: packagePath);
await _runCommand('dart', [
'format', await _runCommand('dart', ['format', '.'], workingDirectory: packagePath);
'--output',
'none',
'.',
], workingDirectory: packagePath);
if (await Directory(path.join(packagePath, 'test')).exists()) { if (await Directory(path.join(packagePath, 'test')).exists()) {
final packagePubspecFile = File(path.join(packagePath, 'pubspec.yaml')); final packagePubspecFile = File(path.join(packagePath, 'pubspec.yaml'));
final packagePubspecContent = await packagePubspecFile.readAsString(); final packagePubspecContent = await packagePubspecFile.readAsString();
if (packagePubspecContent.contains('flutter:')) { if (packagePubspecContent.contains('flutter:')) {
await _runCommand('flutter', ['test'], workingDirectory: packagePath); await _runCommand('flutter', [
'test',
'--no-pub',
], workingDirectory: packagePath);
} else { } else {
await _runCommand('dart', ['test'], workingDirectory: packagePath); await _runCommand('dart', ['test'], workingDirectory: packagePath);
} }

Loading…
Cancel
Save