Skip to content

Commit

Permalink
#1678 moving to flutter 3.24+
Browse files Browse the repository at this point in the history
  • Loading branch information
kmahmood74 committed Oct 4, 2024
1 parent 001d49c commit 700faaf
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 41 deletions.
52 changes: 48 additions & 4 deletions modules/device_preview/lib/src/views/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ extension ThemeToolbarExtension on DevicePreviewToolBarThemeData {
primaryColor: accentColor,
primaryColorDark: accentColor,
indicatorColor: accentColor,
toggleableActiveColor: accentColor,
highlightColor: accentColor.withOpacity(0.1),
sliderTheme: base.sliderTheme.copyWith(
thumbColor: accentColor,
Expand All @@ -37,7 +36,30 @@ extension ThemeToolbarExtension on DevicePreviewToolBarThemeData {
activeTickMarkColor: accentColor,
inactiveTickMarkColor: accentColor,
overlayColor: accentColor.withOpacity(0.12),
),
), checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
), radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
), switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
),
);
case DevicePreviewToolBarThemeData.light:
final base = ThemeData.light();
Expand All @@ -51,7 +73,6 @@ extension ThemeToolbarExtension on DevicePreviewToolBarThemeData {
primaryColor: accentColor,
primaryColorDark: accentColor,
indicatorColor: accentColor,
toggleableActiveColor: accentColor,
highlightColor: accentColor,
appBarTheme: base.appBarTheme.copyWith(
color: barColor,
Expand All @@ -63,7 +84,30 @@ extension ThemeToolbarExtension on DevicePreviewToolBarThemeData {
activeTickMarkColor: accentColor,
inactiveTickMarkColor: accentColor,
overlayColor: accentColor.withOpacity(0.12),
),
), checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
), radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
), switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return accentColor; }
return null;
}),
),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ToolPanelSection extends StatelessWidget {
),
child: Text(
title.toUpperCase(),
style: theme.textTheme.subtitle2?.copyWith(
style: theme.textTheme.titleSmall?.copyWith(
color: theme.hintColor,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SettingsSection extends StatelessWidget {
shape: BoxShape.circle,
color: background.scaffoldBackgroundColor,
border: Border.all(
color: toolbar.backgroundColor,
color: Theme.of(context).colorScheme.surface,
width: 1,
),
),
Expand Down Expand Up @@ -84,7 +84,7 @@ class SettingsSection extends StatelessWidget {
shape: BoxShape.circle,
color: toolbar.scaffoldBackgroundColor,
border: Border.all(
color: toolbar.backgroundColor,
color: Theme.of(context).colorScheme.surface,
width: 1,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class _TypeSectionHeader extends StatelessWidget {
}
}()
.toUpperCase(),
style: theme.textTheme.subtitle2?.copyWith(
style: theme.textTheme.titleSmall?.copyWith(
color: theme.hintColor,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _ToolPanel extends StatelessWidget {
appBar: AppBar(
title: Text(
'Device preview',
style: theme.textTheme.headline6?.copyWith(
style: theme.textTheme.titleLarge?.copyWith(
fontSize: 14,
fontWeight: FontWeight.bold,
color: (theme.colorScheme.brightness == Brightness.dark
Expand Down
47 changes: 23 additions & 24 deletions modules/ensemble/lib/ensemble_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class EnsembleTheme {
}

static const TextTheme textTheme = TextTheme(
headline4: display1,
headline5: headline,
headline6: title,
subtitle2: subtitle,
bodyText1: body2,
bodyText2: body1,
caption: caption,
headlineMedium: display1,
headlineSmall: headline,
titleLarge: title,
titleSmall: subtitle,
bodyLarge: body2,
bodyMedium: body1,
bodySmall: caption,
);

static const TextStyle display1 = TextStyle(
Expand Down Expand Up @@ -118,19 +118,19 @@ class EnsembleTheme {
static TextTheme _buildTextThemeOld(TextTheme base) {
const String fontName = 'WorkSans';
return base.copyWith(
headline1: base.headline1?.copyWith(fontFamily: fontName),
headline2: base.headline2?.copyWith(fontFamily: fontName),
headline3: base.headline3?.copyWith(fontFamily: fontName),
headline4: base.headline4?.copyWith(fontFamily: fontName),
headline5: base.headline5?.copyWith(fontFamily: fontName),
headline6: base.headline6?.copyWith(fontFamily: fontName),
button: base.button?.copyWith(fontFamily: fontName),
caption: base.caption?.copyWith(fontFamily: fontName),
bodyText1: base.bodyText1?.copyWith(fontFamily: fontName),
bodyText2: base.bodyText2?.copyWith(fontFamily: fontName),
subtitle1: base.subtitle1?.copyWith(fontFamily: fontName),
subtitle2: base.subtitle2?.copyWith(fontFamily: fontName),
overline: base.overline?.copyWith(fontFamily: fontName),
displayLarge: base.displayLarge?.copyWith(fontFamily: fontName),
displayMedium: base.displayMedium?.copyWith(fontFamily: fontName),
displaySmall: base.displaySmall?.copyWith(fontFamily: fontName),
headlineMedium: base.headlineMedium?.copyWith(fontFamily: fontName),
headlineSmall: base.headlineSmall?.copyWith(fontFamily: fontName),
titleLarge: base.titleLarge?.copyWith(fontFamily: fontName),
labelLarge: base.labelLarge?.copyWith(fontFamily: fontName),
bodySmall: base.bodySmall?.copyWith(fontFamily: fontName),
bodyLarge: base.bodyLarge?.copyWith(fontFamily: fontName),
bodyMedium: base.bodyMedium?.copyWith(fontFamily: fontName),
titleMedium: base.titleMedium?.copyWith(fontFamily: fontName),
titleSmall: base.titleSmall?.copyWith(fontFamily: fontName),
labelSmall: base.labelSmall?.copyWith(fontFamily: fontName),
);
}

Expand All @@ -140,27 +140,26 @@ class EnsembleTheme {
final ColorScheme colorScheme = const ColorScheme.light().copyWith(
primary: primaryColor,
secondary: secondaryColor,
surface: Colors.white,
error: const Color(0xFFB00020),
);
final ThemeData base = ThemeData.light();
return base.copyWith(
colorScheme: colorScheme,
primaryColor: primaryColor,
indicatorColor: Colors.white,
splashColor: Colors.white24,
splashFactory: InkRipple.splashFactory,
//accentColor: secondaryColor,
canvasColor: Colors.white,
backgroundColor: const Color(0xFFFFFFFF),
scaffoldBackgroundColor: const Color(0xFFF6F6F6),
errorColor: const Color(0xFFB00020),
buttonTheme: ButtonThemeData(
colorScheme: colorScheme,
textTheme: ButtonTextTheme.primary,
),
textTheme: _buildTextThemeOld(base.textTheme),
primaryTextTheme: _buildTextThemeOld(base.primaryTextTheme),
//accentTextTheme: _buildTextThemeOld(base.accentTextTheme),
platform: TargetPlatform.iOS,
platform: TargetPlatform.iOS, colorScheme: colorScheme.copyWith(background: const Color(0xFFFFFFFF)),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/ensemble/lib/widget/carousel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class MyController extends BoxController {
int selectedItemIndex = 0;
int? indicatorMaxCount;

final e.CarouselController _carouselController = e.CarouselController();
final e.CarouselSliderController _carouselController = e.CarouselSliderController();
}

class CarouselState extends EWidgetState<Carousel>
Expand Down
4 changes: 2 additions & 2 deletions modules/ensemble/lib/widget/visualization/barchart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class EnsembleBarChartState extends BaseWidgetState<EnsembleBarChart>
return BarTouchData(
enabled: true,
touchTooltipData: BarTouchTooltipData(
tooltipBgColor: Colors.orangeAccent,
getTooltipColor: (group) => Colors.orangeAccent,
tooltipPadding: const EdgeInsets.all(0),
tooltipMargin: 8,
getTooltipItem: (
Expand Down Expand Up @@ -170,7 +170,7 @@ class EnsembleBarChartState extends BaseWidgetState<EnsembleBarChart>
BarTouchData get barTouchData => BarTouchData(
enabled: true,
touchTooltipData: BarTouchTooltipData(
tooltipBgColor: Colors.orangeAccent,
getTooltipColor: (group) => Colors.orangeAccent,
tooltipPadding: const EdgeInsets.all(0),
tooltipMargin: 8,
getTooltipItem: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ mixin ChartDefaults {
LineTouchData get lineTouchData => LineTouchData(
handleBuiltInTouches: true,
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.blueGrey.withOpacity(0.8),
getTooltipColor: (group) => Colors.blueGrey.withOpacity(0.8),
),
);
FlGridData get gridData => FlGridData(show: true);
Expand Down
6 changes: 3 additions & 3 deletions modules/ensemble/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ version: 1.0.9

environment:
sdk: ">=3.0.6 <4.0.0"
flutter: '<=3.19.6'
flutter: '>=3.24.0'

dependencies:
flutter:
Expand All @@ -39,7 +39,7 @@ dependencies:
cupertino_icons: ^1.0.2
http: ^1.2.1
flutter_rating_bar: ^4.0.0
fl_chart: ^0.62.0
fl_chart: ^0.69.0
signature: ^5.5.0

ensemble_icons:
Expand Down Expand Up @@ -75,7 +75,7 @@ dependencies:
flutter_svg_provider: ^1.0.4
qr_flutter: ^4.1.0
device_info_plus: ^9.1.2
carousel_slider: ^4.1.1
carousel_slider: ^5.0.0
fluttertoast: 8.2.2
video_player: ^2.6.1
lottie: ^3.0.0
Expand Down
2 changes: 1 addition & 1 deletion starter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ version: 1.0.0+1

environment:
sdk: ">=3.0.6 <4.0.0"
flutter: '<=3.19.6'
flutter: '>=3.24.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand Down

0 comments on commit 700faaf

Please sign in to comment.