pull/2701/head
Eric Windmill 1 month ago
parent fa39baa96d
commit 8b19871277

4
.gitignore vendored

@ -81,3 +81,7 @@ yarn.lock
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
.claude/
.gemini/
logs/

@ -1,5 +1,9 @@
include: package:flutter_lints/flutter.yaml
formatter:
trailing_commas: preserve
page_width: 75
analyzer:
language:
strict-casts: true

@ -9,3 +9,5 @@ environment:
# The `flutter_lints` dependency is required for `lib/flutter.yaml`.
dependencies:
flutter_lints: ^5.0.0

@ -6,18 +6,16 @@ publish_to: "none"
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
flutter:
sdk: flutter
dev_dependencies:
analysis_defaults:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:

@ -4,7 +4,7 @@ version: 1.0.0+1
publish_to: none
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
@ -22,7 +22,6 @@ dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:

@ -4,7 +4,7 @@ publish_to: 'none'
version: 0.1.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:

@ -6,7 +6,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
cupertino_icons: ^1.0.2
@ -23,6 +23,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@ -32,7 +32,6 @@ dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
@ -44,7 +43,6 @@ dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

@ -4,7 +4,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.1.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:

@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@ -31,7 +31,6 @@ dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
@ -41,7 +40,6 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your

@ -3,7 +3,7 @@ description: "Sample app for the google_generative_ai package"
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:

@ -3,7 +3,7 @@ description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
@ -19,6 +19,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -4,7 +4,7 @@ publish_to: "none"
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:

@ -7,12 +7,11 @@ publish_to: 'none'
version: 0.0.1+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
sdk: flutter
audioplayers: ^6.0.0
cupertino_icons: ^1.0.2
go_router: ^15.0.0

@ -3,7 +3,7 @@ description: "Sample app for the google_generative_ai package"
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:

@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:

@ -5,12 +5,11 @@ publish_to: none
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
meta: ^1.3.0
provider: ^6.0.2
@ -24,6 +23,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -6,12 +6,11 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
device_info: ^2.0.3
@ -20,5 +19,4 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:

@ -207,8 +207,9 @@ class RunningList extends StatelessWidget {
@override
Widget build(BuildContext context) {
final progress =
Provider.of<DataTransferIsolateController>(context).currentProgress;
final progress = Provider.of<DataTransferIsolateController>(
context,
).currentProgress;
return DecoratedBox(
decoration: BoxDecoration(color: Colors.grey[200]),

@ -208,10 +208,9 @@ class RunningList extends StatelessWidget {
return Column(
children: [
Card(
color:
(controller.created && !controller.paused)
? Colors.lightGreenAccent
: Colors.deepOrangeAccent,
color: (controller.created && !controller.paused)
? Colors.lightGreenAccent
: Colors.deepOrangeAccent,
child: ListTile(
leading: Text('${sums.length - index}.'),
title: Text('${sums[index]}.'),

@ -57,8 +57,9 @@ class _PerformancePageState extends State<PerformancePage> {
return ElevatedButton(
style: ElevatedButton.styleFrom(elevation: 8.0),
onPressed: switch (snapshot.connectionState) {
ConnectionState.done =>
() => handleComputeOnMain(context),
ConnectionState.done => () => handleComputeOnMain(
context,
),
_ => null,
},
child: const Text('Compute on Main'),
@ -71,8 +72,9 @@ class _PerformancePageState extends State<PerformancePage> {
return ElevatedButton(
style: ElevatedButton.styleFrom(elevation: 8.0),
onPressed: switch (snapshot.connectionState) {
ConnectionState.done =>
() => handleComputeOnSecondary(context),
ConnectionState.done => () => handleComputeOnSecondary(
context,
),
_ => null,
},
child: const Text('Compute on Secondary'),
@ -88,12 +90,12 @@ class _PerformancePageState extends State<PerformancePage> {
}
void handleComputeOnMain(BuildContext context) {
var future =
computeOnMainIsolate()..then((_) {
var snackBar = const SnackBar(content: Text('Main Isolate Done!'));
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(snackBar);
});
var future = computeOnMainIsolate()
..then((_) {
var snackBar = const SnackBar(content: Text('Main Isolate Done!'));
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(snackBar);
});
setState(() {
computeFuture = future;
@ -101,14 +103,12 @@ class _PerformancePageState extends State<PerformancePage> {
}
void handleComputeOnSecondary(BuildContext context) {
var future =
computeOnSecondaryIsolate()..then((_) {
var snackBar = const SnackBar(
content: Text('Secondary Isolate Done!'),
);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(snackBar);
});
var future = computeOnSecondaryIsolate()
..then((_) {
var snackBar = const SnackBar(content: Text('Secondary Isolate Done!'));
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(snackBar);
});
setState(() {
computeFuture = future;

@ -4,7 +4,7 @@ version: 1.0.0+1
publish_to: none
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
@ -20,6 +20,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -53,4 +53,10 @@ Next:
- Run the CLI command `flutter channel beta` to ensure the Flutter SDK on my machine is using the latest beta
- Run the CI running the bash file @/tool/flutter_ci_script_stable.sh
- When there's a non-0 response, attempt to fix the issue.
-
- remove samples and replace with a README
- Update script to look into sub-directories. Because some projects are themselves mono repos.
- Make sure this is in every pubspec yaml
analysis_defaults:
path: ../analysis_defaults

@ -73,22 +73,19 @@ class _AppState extends State<App> {
title: 'Material 3',
themeMode: _themeMode,
theme: ThemeData(
colorSchemeSeed:
_colorSelectionMethod == ColorSelectionMethod.colorSeed
? _colorSelected.color
: null,
colorScheme:
_colorSelectionMethod == ColorSelectionMethod.image
? _imageColorScheme
: null,
colorSchemeSeed: _colorSelectionMethod == ColorSelectionMethod.colorSeed
? _colorSelected.color
: null,
colorScheme: _colorSelectionMethod == ColorSelectionMethod.image
? _imageColorScheme
: null,
useMaterial3: _useMaterial3,
brightness: Brightness.light,
),
darkTheme: ThemeData(
colorSchemeSeed:
_colorSelectionMethod == ColorSelectionMethod.colorSeed
? _colorSelected.color
: _imageColorScheme!.primary,
colorSchemeSeed: _colorSelectionMethod == ColorSelectionMethod.colorSeed
? _colorSelected.color
: _imageColorScheme!.primary,
useMaterial3: _useMaterial3,
brightness: Brightness.dark,
),

@ -23,10 +23,9 @@ class BrightnessButton extends StatelessWidget {
preferBelow: showTooltipBelow,
message: 'Toggle brightness',
child: IconButton(
icon:
isBright
? const Icon(Icons.dark_mode_outlined)
: const Icon(Icons.light_mode_outlined),
icon: isBright
? const Icon(Icons.dark_mode_outlined)
: const Icon(Icons.light_mode_outlined),
onPressed: () => handleBrightnessChange(!isBright),
),
);
@ -50,10 +49,9 @@ class Material3Button extends StatelessWidget {
preferBelow: showTooltipBelow,
message: 'Switch to Material ${useMaterial3 ? 2 : 3}',
child: IconButton(
icon:
useMaterial3
? const Icon(Icons.filter_2)
: const Icon(Icons.filter_3),
icon: useMaterial3
? const Icon(Icons.filter_2)
: const Icon(Icons.filter_3),
onPressed: handleMaterialVersionChange,
),
);

@ -61,16 +61,13 @@ class ColorPalettesScreen extends StatelessWidget {
TextSpan(
text: 'dynamic_color',
style: const TextStyle(decoration: TextDecoration.underline),
recognizer:
TapGestureRecognizer()
..onTap = () async {
final url = Uri.parse(
'https://pub.dev/packages/dynamic_color',
);
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
},
recognizer: TapGestureRecognizer()
..onTap = () async {
final url = Uri.parse('https://pub.dev/packages/dynamic_color');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
},
),
const TextSpan(text: ' package.'),
],
@ -454,7 +451,9 @@ class ColorChip extends StatelessWidget {
padding: const EdgeInsets.all(16),
child: Row(
children: [
Expanded(child: Text(label, style: TextStyle(color: labelColor))),
Expanded(
child: Text(label, style: TextStyle(color: labelColor)),
),
],
),
),

@ -49,10 +49,9 @@ class FirstComponentList extends StatelessWidget {
child: CustomScrollView(
slivers: [
SliverPadding(
padding:
showSecondList
? const EdgeInsetsDirectional.only(end: smallSpacing)
: EdgeInsets.zero,
padding: showSecondList
? const EdgeInsetsDirectional.only(end: smallSpacing)
: EdgeInsets.zero,
sliver: SliverList(
delegate: BuildSlivers(
heights: heights,
@ -737,51 +736,49 @@ class _DialogsState extends State<Dialogs> {
void openDialog(BuildContext context) {
showDialog<void>(
context: context,
builder:
(context) => AlertDialog(
title: const Text('What is a dialog?'),
content: const Text(
'A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made.',
),
actions: <Widget>[
TextButton(
child: const Text('Dismiss'),
onPressed: () => Navigator.of(context).pop(),
),
FilledButton(
child: const Text('Okay'),
onPressed: () => Navigator.of(context).pop(),
),
],
builder: (context) => AlertDialog(
title: const Text('What is a dialog?'),
content: const Text(
'A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made.',
),
actions: <Widget>[
TextButton(
child: const Text('Dismiss'),
onPressed: () => Navigator.of(context).pop(),
),
FilledButton(
child: const Text('Okay'),
onPressed: () => Navigator.of(context).pop(),
),
],
),
);
}
void openFullscreenDialog(BuildContext context) {
showDialog<void>(
context: context,
builder:
(context) => Dialog.fullscreen(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Scaffold(
appBar: AppBar(
title: const Text('Full-screen dialog'),
centerTitle: false,
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
actions: [
TextButton(
child: const Text('Close'),
onPressed: () => Navigator.of(context).pop(),
),
],
),
builder: (context) => Dialog.fullscreen(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Scaffold(
appBar: AppBar(
title: const Text('Full-screen dialog'),
centerTitle: false,
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
actions: [
TextButton(
child: const Text('Close'),
onPressed: () => Navigator.of(context).pop(),
),
],
),
),
),
),
);
}
@ -874,26 +871,24 @@ class _SwitchRowState extends State<SwitchRow> {
// TODO: use SwitchListTile when thumbIcon is available https://github.com/flutter/flutter/issues/118616
Switch(
value: value0,
onChanged:
widget.isEnabled
? (value) {
setState(() {
value0 = value;
});
}
: null,
onChanged: widget.isEnabled
? (value) {
setState(() {
value0 = value;
});
}
: null,
),
Switch(
thumbIcon: thumbIcon,
value: value1,
onChanged:
widget.isEnabled
? (value) {
setState(() {
value1 = value;
});
}
: null,
onChanged: widget.isEnabled
? (value) {
setState(() {
value1 = value;
});
}
: null,
),
],
);
@ -1186,12 +1181,11 @@ class _NavigationBarsState extends State<NavigationBars> {
});
if (!widget.isExampleBar) widget.onSelectItem!(index);
},
destinations:
widget.isExampleBar && widget.isBadgeExample
? barWithBadgeDestinations
: widget.isExampleBar
? exampleBarDestinations
: appBarDestinations,
destinations: widget.isExampleBar && widget.isBadgeExample
? barWithBadgeDestinations
: widget.isExampleBar
? exampleBarDestinations
: appBarDestinations,
),
);

@ -32,9 +32,9 @@ class ExpandedImageColorAction extends StatelessWidget {
index: i,
select:
imageSelected == ColorImageProvider.values[i] &&
colorSelectionMethod == ColorSelectionMethod.image
? null
: () => handleImageSelect(i),
colorSelectionMethod == ColorSelectionMethod.image
? null
: () => handleImageSelect(i),
),
),
),

@ -133,32 +133,29 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
PreferredSizeWidget _createAppBar() {
return AppBar(
title:
widget.useMaterial3
? const Text('Material 3')
: const Text('Material 2'),
actions:
!showMediumSizeLayout && !showLargeSizeLayout
? [
BrightnessButton(
handleBrightnessChange: widget.handleBrightnessChange,
),
Material3Button(
handleMaterialVersionChange:
widget.handleMaterialVersionChange,
),
ColorSeedButton(
handleColorSelect: widget.handleColorSelect,
colorSelected: widget.colorSelected,
colorSelectionMethod: widget.colorSelectionMethod,
),
ColorImageButton(
handleImageSelect: widget.handleImageSelect,
imageSelected: widget.imageSelected,
colorSelectionMethod: widget.colorSelectionMethod,
),
]
: [Container()],
title: widget.useMaterial3
? const Text('Material 3')
: const Text('Material 2'),
actions: !showMediumSizeLayout && !showLargeSizeLayout
? [
BrightnessButton(
handleBrightnessChange: widget.handleBrightnessChange,
),
Material3Button(
handleMaterialVersionChange: widget.handleMaterialVersionChange,
),
ColorSeedButton(
handleColorSelect: widget.handleColorSelect,
colorSelected: widget.colorSelected,
colorSelectionMethod: widget.colorSelectionMethod,
),
ColorImageButton(
handleImageSelect: widget.handleImageSelect,
imageSelected: widget.imageSelected,
colorSelectionMethod: widget.colorSelectionMethod,
),
]
: [Container()],
);
}
@ -221,21 +218,20 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
trailing: Expanded(
child: Padding(
padding: const EdgeInsets.only(bottom: 20),
child:
showLargeSizeLayout
? ExpandedTrailingActions(
useLightMode: widget.useLightMode,
handleBrightnessChange: widget.handleBrightnessChange,
useMaterial3: widget.useMaterial3,
handleMaterialVersionChange:
widget.handleMaterialVersionChange,
handleImageSelect: widget.handleImageSelect,
handleColorSelect: widget.handleColorSelect,
colorSelectionMethod: widget.colorSelectionMethod,
imageSelected: widget.imageSelected,
colorSelected: widget.colorSelected,
)
: _trailingActions(),
child: showLargeSizeLayout
? ExpandedTrailingActions(
useLightMode: widget.useLightMode,
handleBrightnessChange: widget.handleBrightnessChange,
useMaterial3: widget.useMaterial3,
handleMaterialVersionChange:
widget.handleMaterialVersionChange,
handleImageSelect: widget.handleImageSelect,
handleColorSelect: widget.handleColorSelect,
colorSelectionMethod: widget.colorSelectionMethod,
imageSelected: widget.imageSelected,
colorSelected: widget.colorSelected,
)
: _trailingActions(),
),
),
),

@ -46,10 +46,9 @@ class _SchemePreviewState extends State<SchemePreview> {
color: scheme.surface,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color:
theme.brightness == widget.brightness
? colors.outlineVariant
: Colors.transparent,
color: theme.brightness == widget.brightness
? colors.outlineVariant
: Colors.transparent,
),
),
padding: const EdgeInsets.only(top: 16, left: 16, right: 16),

@ -8,12 +8,11 @@ publish_to: "none"
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
url_launcher: ^6.1.8
@ -24,6 +23,5 @@ dev_dependencies:
sdk: flutter
integration_test:
sdk: flutter
flutter:
uses-material-design: true

@ -4,7 +4,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
adaptive_navigation: ^0.0.3

@ -4,7 +4,7 @@ version: 0.0.1
publish_to: none
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:

@ -4,12 +4,11 @@ description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
google_maps_flutter: ^2.2.0
provider: ^6.0.2
@ -21,7 +20,6 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
assets:
- assets/

@ -4,12 +4,11 @@ description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.3
go_router: ">=10.1.0 <16.0.0"
@ -18,7 +17,6 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:

@ -3,14 +3,13 @@ description: A project showcasing a Flutter app following different platform IA
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
english_words: ^4.0.0
flutter_lorem: ^2.0.0
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dev_dependencies:
@ -18,6 +17,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -4,12 +4,11 @@ description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.4
dev_dependencies:
@ -17,6 +16,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -5,12 +5,11 @@ publish_to: none
version: 1.0.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
dependencies:
flutter:
sdk: flutter
provider: ^6.0.2
cupertino_icons: ^1.0.3
window_size:
@ -23,6 +22,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -5,7 +5,7 @@ publish_to: none
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
@ -22,7 +22,6 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
@ -16,7 +16,6 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
shaders:

@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
auto_size_text: ^3.0.0
@ -26,6 +26,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>=3.35.0-0.1.pre <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@ -30,7 +30,6 @@ dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
@ -40,7 +39,6 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

@ -4,12 +4,11 @@ description: A sample that shows testing in Flutter.
version: 1.0.0+1
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.3
provider: ^6.0.2
go_router: ">=10.0.0 <16.0.0"

@ -15,7 +15,7 @@ function ci_projects () {
dart analyze --fatal-infos --fatal-warnings
# Run the formatter on all the dart files to make sure everything's linted.
dart format --output none --set-exit-if-changed .
dart format --output none .
# Run the actual tests.
if [ -d "test" ]

@ -0,0 +1,269 @@
#!/bin/bash
set -e
DIR="${BASH_SOURCE%/*}"
# Configuration
LOGS_DIR="logs"
LOG_FILE="$LOGS_DIR/flutter_update_$(date +%Y-%m-%d_%H-%M-%S).log"
TEMP_LOG="/tmp/flutter_temp_$$.log"
# Create logs directory if it doesn't exist
mkdir -p "$LOGS_DIR"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Logging function
log() {
echo -e "$1" | tee -a "$LOG_FILE"
}
log_error() {
echo -e "${RED}ERROR: $1${NC}" | tee -a "$LOG_FILE"
}
log_warning() {
echo -e "${YELLOW}WARNING: $1${NC}" | tee -a "$LOG_FILE"
}
log_info() {
echo -e "${BLUE}INFO: $1${NC}" | tee -a "$LOG_FILE"
}
# Function to check if directory is a Flutter project
is_flutter_project() {
local dir="$1"
[[ -f "$dir/pubspec.yaml" ]] && grep -q "flutter:" "$dir/pubspec.yaml"
}
# Function to get current Flutter version
get_flutter_version() {
flutter --version --machine | grep '"frameworkVersion"' | cut -d'"' -f4
}
# Function to update SDK constraints in pubspec.yaml
update_sdk_constraints() {
local project_dir="$1"
local current_version="$2"
local pubspec="pubspec.yaml"
if [[ ! -f "$pubspec" ]]; then
log_error "pubspec.yaml not found in $project_dir"
return 1
fi
# Extract major and minor version numbers
local major=$(echo "$current_version" | cut -d'.' -f1)
local minor=$(echo "$current_version" | cut -d'.' -f2)
local next_major=$((major + 1))
# Create SDK constraint string
local sdk_constraint=">=$current_version <$next_major.0.0"
# Update only the Dart SDK constraint under environment: section
# This specifically targets the sdk: line under environment: and not flutter dependencies
if grep -A5 "^environment:" "$pubspec" | grep -q "sdk:"; then
# Use perl to update only the environment sdk constraint
perl -i -pe '
BEGIN { $in_env = 0; }
if (/^environment:/) { $in_env = 1; }
elsif (/^\w/ && !/^\s/) { $in_env = 0; }
if ($in_env && /(\s+sdk:\s*)['\''"]?[^'\''"]*['\''"]?/) {
s/(\s+sdk:\s*)['\''"]?[^'\''"]*['\''"]?/$1'\'''"$sdk_constraint"'\''/;
}
' "$pubspec"
log_info "Updated Dart SDK constraint in $project_dir to: $sdk_constraint"
else
log_warning "No Dart SDK constraint found under environment: in $project_dir/pubspec.yaml"
return 1
fi
}
# Function to process a single Flutter project
process_project() {
local project_dir="$1"
local project_name=$(basename "$project_dir")
log ""
log "========================================="
log "Processing project: $project_name"
log "========================================="
cd "$project_dir"
# Get current Flutter version for SDK constraints
local flutter_version
flutter_version=$(get_flutter_version)
if [[ $? -ne 0 ]]; then
log_error "Failed to get Flutter version for $project_name"
return 1
fi
# Update SDK constraints
log_info "Updating SDK constraints to use Flutter $flutter_version"
if ! update_sdk_constraints "$project_dir" "$flutter_version"; then
log_error "Failed to update SDK constraints for $project_name"
return 1
fi
# Update dependencies
log_info "Updating dependencies..."
if ! flutter pub upgrade > "$TEMP_LOG" 2>&1; then
log_error "Failed to upgrade dependencies for $project_name"
cat "$TEMP_LOG" >> "$LOG_FILE"
return 1
fi
# Run pub get
log_info "Running pub get..."
if ! flutter pub get > "$TEMP_LOG" 2>&1; then
log_error "Failed to run pub get for $project_name"
cat "$TEMP_LOG" >> "$LOG_FILE"
return 1
fi
# Run dart analyze and capture output
log_info "Running dart analyze..."
if ! dart analyze > "$TEMP_LOG" 2>&1; then
local exit_code=$?
log_error "Dart analyze found issues in $project_name (exit code: $exit_code)"
# Filter and log only errors, warnings, and infos (not success messages)
if grep -E "(error|warning|info):" "$TEMP_LOG" > /dev/null; then
log "Analyze results for $project_name:"
grep -E "(error|warning|info):" "$TEMP_LOG" >> "$LOG_FILE"
fi
# Check if there are fatal errors (errors that would prevent compilation)
if grep -E "^error:" "$TEMP_LOG" > /dev/null; then
log_error "Fatal errors found in $project_name, skipping further processing"
return 1
fi
else
# Even on success, check for warnings and infos
if grep -E "(warning|info):" "$TEMP_LOG" > /dev/null; then
log "Analyze results for $project_name:"
grep -E "(warning|info):" "$TEMP_LOG" >> "$LOG_FILE"
fi
fi
# Run dart format
log_info "Running dart format..."
if ! dart format . > "$TEMP_LOG" 2>&1; then
log_error "Failed to format code for $project_name"
cat "$TEMP_LOG" >> "$LOG_FILE"
# Continue anyway, formatting errors are not fatal
fi
# Run tests
log_info "Running tests..."
if ! flutter test > "$TEMP_LOG" 2>&1; then
local exit_code=$?
log_error "Tests failed for $project_name (exit code: $exit_code)"
# Log test failures
if grep -E "(FAILED|ERROR|Exception)" "$TEMP_LOG" > /dev/null; then
log "Test failures for $project_name:"
grep -E "(FAILED|ERROR|Exception)" "$TEMP_LOG" >> "$LOG_FILE"
fi
return 1
fi
log_info "Successfully processed $project_name"
return 0
}
# Main execution
main() {
local original_dir="$PWD"
log "Flutter Monorepo Update Script Started: $(date)"
log "Log file: $LOG_FILE"
# Check if Flutter is installed
if ! command -v flutter &> /dev/null; then
log_error "Flutter is not installed or not in PATH"
exit 1
fi
# Upgrade Flutter SDK
log ""
log "========================================="
log "Upgrading Flutter SDK"
log "========================================="
if ! flutter upgrade > "$TEMP_LOG" 2>&1; then
log_error "Failed to upgrade Flutter SDK"
cat "$TEMP_LOG" >> "$LOG_FILE"
exit 1
fi
local flutter_version
flutter_version=$(get_flutter_version)
log_info "Flutter upgraded to version: $flutter_version"
# Find all Flutter projects in the current directory
local projects=()
for dir in */; do
if [[ -d "$dir" ]] && is_flutter_project "$dir"; then
projects+=("$dir")
fi
done
if [[ ${#projects[@]} -eq 0 ]]; then
log_warning "No Flutter projects found in the current directory"
exit 0
fi
log_info "Found ${#projects[@]} Flutter project(s): ${projects[*]}"
# Process each project
local success_count=0
local failure_count=0
local failed_projects=()
for project in "${projects[@]}"; do
if process_project "$project"; then
((success_count++))
else
((failure_count++))
failed_projects+=("$(basename "$project")")
fi
# Return to root directory
cd "$original_dir"
done
# Summary
log ""
log "========================================="
log "Update Summary"
log "========================================="
log_info "Total projects processed: ${#projects[@]}"
log_info "Successful: $success_count"
if [[ $failure_count -gt 0 ]]; then
log_error "Failed: $failure_count"
log_error "Failed projects: ${failed_projects[*]}"
fi
log ""
log "Flutter Monorepo Update Script Completed: $(date)"
# Cleanup
rm -f "$TEMP_LOG"
# Exit with error code if any projects failed
if [[ $failure_count -gt 0 ]]; then
exit 1
fi
}
# Run main function
main "$@"

@ -5,12 +5,11 @@ publish_to: none
version: 1.2.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: '>= <1.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
font_awesome_flutter: ^10.1.0
intl: ^0.20.0

@ -5,7 +5,6 @@ version: 1.0.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
flutter: ">=3.22.0"
dependencies:
flutter:

@ -0,0 +1 @@
Read https://dart.dev/tools/pub/workspaces
Loading…
Cancel
Save