From 1c9fd4d045d974fb4d1d88956c6361930a64f403 Mon Sep 17 00:00:00 2001 From: matt200-ok Date: Thu, 27 Jun 2024 14:54:42 -0700 Subject: [PATCH] Flutter demo updates (#836) --- .github/workflows/flutter-codestyle.yml | 4 +-- .github/workflows/flutter-demos.yml | 16 ++++++---- .../com/example/pico_clock/MainActivity.java | 6 ++++ .../com/example/pico_clock/MainActivity.kt | 6 ---- demo/flutter-clock/lib/main.dart | 32 +++++++++---------- demo/flutter-clock/pubspec.yaml | 4 +-- demo/flutter/lib/main.dart | 4 +-- demo/flutter/pubspec.yaml | 4 +-- 8 files changed, 40 insertions(+), 36 deletions(-) create mode 100644 demo/flutter-clock/android/app/src/main/java/com/example/pico_clock/MainActivity.java delete mode 100644 demo/flutter-clock/android/app/src/main/kotlin/com/example/pico_clock/MainActivity.kt diff --git a/.github/workflows/flutter-codestyle.yml b/.github/workflows/flutter-codestyle.yml index 9c393f9a2..6bb285a1e 100644 --- a/.github/workflows/flutter-codestyle.yml +++ b/.github/workflows/flutter-codestyle.yml @@ -26,10 +26,10 @@ jobs: with: submodules: recursive - - name: Install Flutter 2.8.1 + - name: Install Flutter 3.22.2 uses: subosito/flutter-action@v2 with: - flutter-version: 2.8.1 + flutter-version: 3.22.2 - name: Run Binding Analyzer run: flutter analyze --no-fatal-infos --no-fatal-warnings diff --git a/.github/workflows/flutter-demos.yml b/.github/workflows/flutter-demos.yml index 1227422a3..0e9cec38e 100644 --- a/.github/workflows/flutter-demos.yml +++ b/.github/workflows/flutter-demos.yml @@ -8,12 +8,16 @@ on: - '.github/workflows/flutter.yml' - 'demo/flutter/**' - '!demo/flutter/README.md' + - 'demo/flutter-clock/**' + - '!demo/flutter-clock/README.md' pull_request: branches: [ master, 'v[0-9]+.[0-9]+' ] paths: - '.github/workflows/flutter.yml' - 'demo/flutter/**' - '!demo/flutter/README.md' + - 'demo/flutter-clock/**' + - '!demo/flutter-clock/README.md' defaults: run: @@ -25,7 +29,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - flutter-version: ['2.8.1', '3.0.4'] + flutter-version: ['3.3.0', '3.22.2'] steps: - uses: actions/checkout@v3 @@ -54,10 +58,10 @@ jobs: build-ios: name: Build iOS demo - runs-on: macos-11 + runs-on: macos-12 strategy: matrix: - flutter-version: ['2.8.1', '3.0.4'] + flutter-version: ['3.3.0', '3.22.2'] steps: - uses: actions/checkout@v3 @@ -90,7 +94,7 @@ jobs: strategy: matrix: - flutter-version: ['2.8.1', '3.0.4'] + flutter-version: ['2.10.0', '3.3.0', '3.22.2'] steps: - uses: actions/checkout@v3 @@ -118,14 +122,14 @@ jobs: run: flutter build apk build-clock-ios: - runs-on: macos-11 + runs-on: macos-12 defaults: run: working-directory: demo/flutter-clock strategy: matrix: - flutter-version: ['2.8.1', '3.0.4'] + flutter-version: ['2.10.0', '3.3.0', '3.22.2'] steps: - uses: actions/checkout@v3 diff --git a/demo/flutter-clock/android/app/src/main/java/com/example/pico_clock/MainActivity.java b/demo/flutter-clock/android/app/src/main/java/com/example/pico_clock/MainActivity.java new file mode 100644 index 000000000..87e8d6df7 --- /dev/null +++ b/demo/flutter-clock/android/app/src/main/java/com/example/pico_clock/MainActivity.java @@ -0,0 +1,6 @@ +package com.example.pico_clock; + +import io.flutter.embedding.android.FlutterActivity; + +public class MainActivity extends FlutterActivity { +} diff --git a/demo/flutter-clock/android/app/src/main/kotlin/com/example/pico_clock/MainActivity.kt b/demo/flutter-clock/android/app/src/main/kotlin/com/example/pico_clock/MainActivity.kt deleted file mode 100644 index a9633eda6..000000000 --- a/demo/flutter-clock/android/app/src/main/kotlin/com/example/pico_clock/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.pico_clock - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/demo/flutter-clock/lib/main.dart b/demo/flutter-clock/lib/main.dart index 9cc393b55..a89b7fe7f 100644 --- a/demo/flutter-clock/lib/main.dart +++ b/demo/flutter-clock/lib/main.dart @@ -31,13 +31,13 @@ class MyApp extends StatelessWidget { focusColor: picoBlue, highlightColor: picoRed, textTheme: TextTheme( - headline1: TextStyle( + displayLarge: TextStyle( fontSize: 60, fontWeight: FontWeight.bold, color: picoBlue), - headline2: TextStyle( + displayMedium: TextStyle( fontSize: 60, fontWeight: FontWeight.bold, color: picoGrey), - subtitle1: TextStyle(fontSize: 23, color: picoGrey), - subtitle2: TextStyle(fontSize: 15, color: picoRed), - bodyText1: TextStyle(fontSize: 18, color: lightGrey))), + titleMedium: TextStyle(fontSize: 23, color: picoGrey), + titleSmall: TextStyle(fontSize: 15, color: picoRed), + bodyLarge: TextStyle(fontSize: 18, color: lightGrey))), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } @@ -141,10 +141,10 @@ class _MyHomePageState extends State { _performStopwatchCommand(slots); } else if (inference.intent! == 'availableCommands') { Fluttertoast.showToast( - msg: "Try saying: \n" + - " - 'set timer for 5 minutes'\n" + - " - 'set alarm for tomorrow at 10:30am'\n" + - " - 'start stopwatch'\n" + + msg: "Try saying: \n" + " - 'set timer for 5 minutes'\n" + " - 'set alarm for tomorrow at 10:30am'\n" + " - 'start stopwatch'\n" " - 'show me the time'", toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.TOP, @@ -155,7 +155,7 @@ class _MyHomePageState extends State { } } else { Fluttertoast.showToast( - msg: "Didn't understand command!\n" + + msg: "Didn't understand command!\n" "Say 'PicoClock, what can I say?' to see a list of example commands", toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.TOP, @@ -416,14 +416,14 @@ class _MyHomePageState extends State { alignment: Alignment.center, child: Text( DateFormat.jm().format(_clockTime), - style: Theme.of(context).textTheme.headline1, + style: Theme.of(context).textTheme.displayLarge, )), Container( alignment: Alignment.center, padding: EdgeInsets.only(top: 100), child: Text( DateFormat.MMMMEEEEd().format(_clockTime), - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, )), Container( alignment: Alignment.bottomCenter, @@ -441,7 +441,7 @@ class _MyHomePageState extends State { _alarmTime == null || _alarmTextInvisible ? "" : DateFormat.MMMEd().add_jm().format(_alarmTime!), - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, )), ]); } @@ -459,7 +459,7 @@ class _MyHomePageState extends State { : _timerStopwatch.isRunning ? timerStr : "00:00:00", - style: Theme.of(context).textTheme.headline1, + style: Theme.of(context).textTheme.displayLarge, )), ]); } @@ -477,7 +477,7 @@ class _MyHomePageState extends State { alignment: Alignment.center, child: Text( stopwatchStr, - style: Theme.of(context).textTheme.headline1, + style: Theme.of(context).textTheme.displayLarge, )), ]); } @@ -533,7 +533,7 @@ class _MyHomePageState extends State { Container( margin: EdgeInsets.only(bottom: 10), child: Text("Say 'PicoClock'!", - style: Theme.of(context).textTheme.bodyText1)) + style: Theme.of(context).textTheme.bodyLarge)) ], ) ]), diff --git a/demo/flutter-clock/pubspec.yaml b/demo/flutter-clock/pubspec.yaml index 8bec890df..bf0236d5a 100644 --- a/demo/flutter-clock/pubspec.yaml +++ b/demo/flutter-clock/pubspec.yaml @@ -5,8 +5,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.15.0 <4.0.0" - flutter: ">=2.8.1" + sdk: ">=2.16.0 <4.0.0" + flutter: ">=2.10.0" dependencies: flutter: diff --git a/demo/flutter/lib/main.dart b/demo/flutter/lib/main.dart index 241d18a0b..d378e964c 100644 --- a/demo/flutter/lib/main.dart +++ b/demo/flutter/lib/main.dart @@ -260,7 +260,7 @@ class _MyAppState extends State { buildContextHeader(BuildContext context) { final ButtonStyle buttonStyle = ElevatedButton.styleFrom( - primary: picoBlue, textStyle: TextStyle(color: Colors.white)); + backgroundColor: picoBlue, textStyle: TextStyle(color: Colors.white)); return Expanded( flex: 1, @@ -299,7 +299,7 @@ class _MyAppState extends State { buildStartButton(BuildContext context) { final ButtonStyle buttonStyle = ElevatedButton.styleFrom( - primary: picoBlue, + backgroundColor: picoBlue, shape: CircleBorder(), textStyle: TextStyle(color: Colors.white)); diff --git a/demo/flutter/pubspec.yaml b/demo/flutter/pubspec.yaml index accc048be..e21218925 100644 --- a/demo/flutter/pubspec.yaml +++ b/demo/flutter/pubspec.yaml @@ -6,8 +6,8 @@ publish_to: 'none' version: 1.0.0 environment: - sdk: ">=2.15.0 <4.0.0" - flutter: ">=2.8.1" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: flutter: