Skip to content

Commit

Permalink
chore: Bump Flutter version to 3.22 (openfoodfacts#5458)
Browse files Browse the repository at this point in the history
* Bump Flutter version to 3.22

* Migrate Material properties
  • Loading branch information
g123k committed Jul 4, 2024
1 parent 8c10181 commit 9e211ca
Show file tree
Hide file tree
Showing 41 changed files with 137 additions and 147 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

- Make sure you have installed flutter and all the requirements
- [Official flutter installation guide](https://docs.flutter.dev/get-started/install)
- Currently, the app uses the latest stable version of Flutter (3.19.x).
- Currently, the app uses the following version of Flutter (3.22.x).


We have predefined run configurations for Android Studio and Visual Studio Code
Expand Down
2 changes: 1 addition & 1 deletion flutter-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.19.5
3.22.2
2 changes: 1 addition & 1 deletion packages/app_store/apple_app_store/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.0.1
publish_to: "none"

environment:
sdk: '>=3.3.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/app_store/google_play/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.0.1
publish_to: "none"

environment:
sdk: '>=3.3.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/app_store/shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: "none"

environment:
sdk: '>=3.3.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/app_store/uri_store/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.0.1
publish_to: "none"

environment:
sdk: '>=3.3.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/scanner/ml_kit/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: "none"

environment:
sdk: '>=3.3.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/scanner/shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: "none"

environment:
sdk: '>=3.3.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/scanner/zxing/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: "none"

environment:
sdk: '>=3.3.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ class SmoothSimpleButton extends StatelessWidget {
style: ButtonStyle(
backgroundColor: buttonColor == null
? null
: MaterialStateProperty.all<Color>(buttonColor!),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
: WidgetStateProperty.all<Color>(buttonColor!),
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(borderRadius: borderRadius),
),
overlayColor: context.read<ThemeProvider>().isAmoledTheme
? MaterialStateProperty.resolveWith((Set<MaterialState> states) {
return states.contains(MaterialState.pressed)
? WidgetStateProperty.resolveWith((Set<WidgetState> states) {
return states.contains(WidgetState.pressed)
? Theme.of(context).colorScheme.primary.withOpacity(0.3)
: null;
})
: null,
side: context.read<ThemeProvider>().isAmoledTheme
? MaterialStateProperty.all<BorderSide>(
? WidgetStateProperty.all<BorderSide>(
const BorderSide(color: Colors.white),
)
: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class _SmoothDialogTitle extends StatelessWidget {
],
),
),
Divider(color: Theme.of(context).colorScheme.onBackground),
Divider(color: Theme.of(context).colorScheme.onSurface),
const SizedBox(height: 12),
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class QuestionAnswersOptions extends StatelessWidget {
child: TextButton.icon(
onPressed: () => onAnswer(insightAnnotation),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(backgroundColor),
shape: MaterialStateProperty.all(
backgroundColor: WidgetStateProperty.all(backgroundColor),
shape: WidgetStateProperty.all(
const RoundedRectangleBorder(
borderRadius: ROUNDED_BORDER_RADIUS,
),
Expand Down
6 changes: 3 additions & 3 deletions packages/smooth_app/lib/pages/image_crop_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ class _ImageSourceButton extends StatelessWidget {
child: OutlinedButton(
onPressed: onPressed,
style: ButtonStyle(
side: MaterialStatePropertyAll<BorderSide>(
side: WidgetStatePropertyAll<BorderSide>(
BorderSide(color: primaryColor),
),
padding: const MaterialStatePropertyAll<EdgeInsetsGeometry>(
padding: const WidgetStatePropertyAll<EdgeInsetsGeometry>(
EdgeInsets.symmetric(vertical: LARGE_SPACE),
),
shape: MaterialStatePropertyAll<OutlinedBorder>(
shape: WidgetStatePropertyAll<OutlinedBorder>(
RoundedRectangleBorder(
borderRadius: ROUNDED_BORDER_RADIUS,
side: BorderSide(color: primaryColor),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class _LocationQueryPageState extends State<LocationQueryPage>
data: ListTileThemeData(
titleTextStyle: const TextStyle(fontSize: 20.0),
minLeadingWidth: 18.0,
iconColor: Theme.of(context).colorScheme.onBackground,
textColor: Theme.of(context).colorScheme.onBackground,
iconColor: Theme.of(context).colorScheme.onSurface,
textColor: Theme.of(context).colorScheme.onSurface,
),
child: ListView.builder(
itemBuilder: (BuildContext context, int index) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ class OnboardingBottomButton extends StatelessWidget {
key: nextKey,
onPressed: onPressed,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(backgroundColor),
backgroundColor: WidgetStateProperty.all(backgroundColor),
overlayColor: backgroundColor == Colors.white
? MaterialStateProperty.all<Color>(
Theme.of(context).splashColor)
? WidgetStateProperty.all<Color>(Theme.of(context).splashColor)
: null,
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(40))),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,31 @@ class OnboardingBottomHills extends StatelessWidget {
end: 15.0,
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
backgroundColor: WidgetStateProperty.all<Color>(
Colors.white,
),
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
padding: WidgetStateProperty.all<EdgeInsetsGeometry>(
const EdgeInsetsDirectional.only(
start: LARGE_SPACE + 1.0,
end: LARGE_SPACE,
top: SMALL_SPACE,
bottom: SMALL_SPACE,
),
),
elevation: MaterialStateProperty.all<double>(4.0),
iconColor: MaterialStateProperty.all<Color>(
elevation: WidgetStateProperty.all<double>(4.0),
iconColor: WidgetStateProperty.all<Color>(
colors.orange,
),
foregroundColor: MaterialStateProperty.all<Color>(
foregroundColor: WidgetStateProperty.all<Color>(
colors.orange,
),
iconSize: MaterialStateProperty.all<double>(21.0),
shape: MaterialStateProperty.all<OutlinedBorder>(
iconSize: WidgetStateProperty.all<double>(21.0),
shape: WidgetStateProperty.all<OutlinedBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
),
shadowColor: MaterialStateProperty.all<Color>(
shadowColor: WidgetStateProperty.all<Color>(
Colors.black.withOpacity(0.50),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ class UserPreferencesAccount extends AbstractUserPreferences {
child: ElevatedButton(
onPressed: () async => _goToLoginPage(),
style: ButtonStyle(
minimumSize: MaterialStateProperty.all<Size>(
minimumSize: WidgetStateProperty.all<Size>(
Size(size.width * 0.5, themeData.buttonTheme.height + 10),
),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
const RoundedRectangleBorder(
borderRadius: CIRCULAR_BORDER_RADIUS,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class UserPreferencesConnect extends AbstractUserPreferences {
'assets/preferences/x-logo.svg',
width: DEFAULT_ICON_SIZE,
colorFilter: ui.ColorFilter.mode(
Theme.of(context).colorScheme.onBackground,
Theme.of(context).colorScheme.onSurface,
ui.BlendMode.srcIn,
),
package: AppHelper.APP_PACKAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class UserPreferencesRateUs extends StatelessWidget {
content: Text(
appLocalizations.error_occurred,
textAlign: TextAlign.center,
style: TextStyle(color: themeData.colorScheme.background),
style: TextStyle(color: themeData.colorScheme.surface),
),
behavior: SnackBarBehavior.floating,
backgroundColor: themeData.colorScheme.onBackground,
backgroundColor: themeData.colorScheme.onSurface,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class UserPreferencesShareWithFriends extends StatelessWidget {
appLocalizations.error,
textAlign: TextAlign.center,
style: TextStyle(
color: themeData.colorScheme.background,
color: themeData.colorScheme.surface,
),
),
behavior: SnackBarBehavior.floating,
backgroundColor: themeData.colorScheme.onBackground,
backgroundColor: themeData.colorScheme.onSurface,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class _ProductListPageState extends State<ProductListPage>
appLocalizations.product_list_empty_message,
textAlign: TextAlign.center,
style: themeData.textTheme.bodyMedium?.apply(
color: themeData.colorScheme.onBackground,
color: themeData.colorScheme.onSurface,
),
),
EMPTY_WIDGET,
Expand Down
8 changes: 4 additions & 4 deletions packages/smooth_app/lib/pages/product/edit_image_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ class EditImageButton extends StatelessWidget {
child: OutlinedButton.icon(
icon: Icon(iconData),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(colorScheme.onPrimary),
shape: MaterialStateProperty.all(
backgroundColor: WidgetStateProperty.all(colorScheme.onPrimary),
shape: WidgetStateProperty.all(
const RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS),
),
side: borderWidth == null
? null
: MaterialStateBorderSide.resolveWith(
: WidgetStateBorderSide.resolveWith(
(_) => BorderSide(
color: colorScheme.primary,
width: borderWidth!,
),
),
padding: _centerContent
? MaterialStateProperty.all(
? WidgetStateProperty.all(
const EdgeInsets.symmetric(
vertical: LARGE_SPACE,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Color _getSmoothCardColorAlternate(final BuildContext context, int index) {
if (index.isOdd) {
cardColor = PRIMARY_GREY_COLOR;
} else {
cardColor = darkColorScheme.background;
cardColor = darkColorScheme.surface;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class _EditOcrPageState extends State<EditOcrPage> with UpToDateMixin {
flex: 1,
child: DecoratedBox(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
borderRadius: const BorderRadiusDirectional.only(
topStart: ANGULAR_RADIUS,
topEnd: ANGULAR_RADIUS,
Expand Down
4 changes: 2 additions & 2 deletions packages/smooth_app/lib/pages/product/new_product_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@ class _ProductPageState extends State<ProductPage>
),
child: ElevatedButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(
padding: WidgetStateProperty.all(
const EdgeInsets.symmetric(
horizontal: VERY_LARGE_SPACE, vertical: MEDIUM_SPACE),
),
shape: MaterialStateProperty.all(
shape: WidgetStateProperty.all(
const RoundedRectangleBorder(
borderRadius: ROUNDED_BORDER_RADIUS,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class NutritionAddNutrientButton extends StatelessWidget {
}
},
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
const RoundedRectangleBorder(
borderRadius: ROUNDED_BORDER_RADIUS,
side: BorderSide.none,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class _NutritionPageLoadedState extends State<NutritionPageLoaded>
value: _nutritionContainer.noNutritionData,
onChanged: (final bool value) =>
setState(() => _nutritionContainer.noNutritionData = value),
trackColor: MaterialStateProperty.all(
trackColor: WidgetStateProperty.all(
Theme.of(context).colorScheme.onPrimary),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ class ProductIncompleteCard extends StatelessWidget {
),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
backgroundColor: WidgetStateProperty.all<Color>(
colorScheme.primary,
),
foregroundColor: MaterialStateProperty.all<Color>(
foregroundColor: WidgetStateProperty.all<Color>(
colorScheme.onPrimary,
),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
const RoundedRectangleBorder(borderRadius: ANGULAR_BORDER_RADIUS),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ProductQuestionAnswersOptions extends StatelessWidget {
child: TextButton(
onPressed: () => onAnswer(insightAnnotation),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(backgroundColor),
backgroundColor: WidgetStateProperty.all(backgroundColor),
),
child: Text(
buttonText,
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/pages/scan/scan_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class _ScanHeaderState extends State<ScanHeader> {
final ContinuousScanModel model = context.watch<ContinuousScanModel>();

final ButtonStyle buttonStyle = ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(18.0)),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/pages/scan/scan_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class _ScanPageState extends State<ScanPage> {
color: Colors.white,
child: SafeArea(
child: Container(
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
child: Column(
children: <Widget>[
if (hasACamera)
Expand Down
4 changes: 2 additions & 2 deletions packages/smooth_app/lib/pages/scan/search_history_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class _SearchHistoryViewState extends State<SearchHistoryView> {
data: ListTileThemeData(
titleTextStyle: const TextStyle(fontSize: 20.0),
minLeadingWidth: 18.0,
iconColor: Theme.of(context).colorScheme.onBackground,
textColor: Theme.of(context).colorScheme.onBackground,
iconColor: Theme.of(context).colorScheme.onSurface,
textColor: Theme.of(context).colorScheme.onSurface,
),
child: ListView.builder(
itemBuilder: (BuildContext context, int i) {
Expand Down
Loading

0 comments on commit 9e211ca

Please sign in to comment.