Skip to content

Commit ce7fda9

Browse files
committed
5.6.0
1 parent 794659b commit ce7fda9

File tree

18 files changed

+207
-75
lines changed

18 files changed

+207
-75
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
## 5.6.0
3+
December 14, 2024
4+
- Introduce Splash screen to example app
5+
- deferFirstFrame() in initState() in app_statefulwidget.dart
6+
- Add mixins: class AppErrorHandler with HandleError, StateXonErrorMixin {
7+
- Update the function, runApp(), with optional error handling
8+
void runApp(m.Widget app, {FlutterExceptionHandler? onError, bool? runZoneGuard}) {
9+
210
## 5.5.0
311
December 11, 2024
412
- Introduced parameter, themeAnimationStyle,for class MaterialApp

example/assets/images/meow.gif

498 KB
Loading

example/integration_test/src/tests/unit/src/controller/test_app.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import '_unit_test_controller.dart';
1212
Future<void> testAppController() async {
1313
// This class extends StateXController but implements
1414
// initAsync(), onAsyncError() and onConnectivityChanged()
15-
final app = AppController();
15+
final app = AppStateXController();
1616

1717
// Override to run any asynchronous operations before the app starts
1818
await app.initAsync();

example/lib/src/app/controller/example_controller.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import '/src/model.dart' show Settings;
77
import '/src/view.dart';
88

99
///
10-
class ExampleAppController extends AppController {
10+
class ExampleAppController extends AppStateXController {
1111
factory ExampleAppController() => _this ??= ExampleAppController._();
1212
ExampleAppController._();
1313
static ExampleAppController? _this;
@@ -251,9 +251,20 @@ class ExampleAppController extends AppController {
251251
/// ************** Life cycle events ****************
252252
253253
/// Called to complete any asynchronous operations.
254+
/// In production, this is where databases are opened, logins attempted, etc.
254255
@override
255256
Future<bool> initAsync() async {
256257
final init = await super.initAsync();
258+
259+
// Demonstrating ways to retrieve the StatefulWidget
260+
var widget = firstState!.widget as FlutteryExampleApp;
261+
widget = rootState!.widget as FlutteryExampleApp;
262+
263+
// For demonstration purposes, wait for the Splash Screen to appear for a time at startup.
264+
await Future<bool>.delayed(const Duration(seconds: 10), () {
265+
return true;
266+
});
267+
257268
//
258269
if (initAsyncError) {
259270
initAsyncError = false;

example/lib/src/app/view/app.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ import '/src/model.dart';
55

66
import '/src/view.dart';
77

8-
/// App
8+
/// The App's State object
99
class FlutteryExampleApp extends AppStatefulWidget {
10-
FlutteryExampleApp({super.key});
10+
FlutteryExampleApp({super.key}) : super(
11+
splashScreen: const SplashScreen(), // three ways to present a Splash screen
12+
inSplashScreen: () => const SplashScreen(),
13+
);
1114
// This is the 'App State object' of the application.
1215
@override
1316
AppStateX<FlutteryExampleApp> createAppState() => _ExampleAppState();
17+
18+
@override
19+
Widget? onSplashScreen(BuildContext context) => const SplashScreen();
1420
}
1521

1622
/// This is the 'View' of the application.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
import 'package:flutter/material.dart';
3+
4+
/// A very simple Splash screen
5+
class SplashScreen extends StatelessWidget {
6+
///
7+
const SplashScreen({super.key});
8+
9+
@override
10+
Widget build(BuildContext context) => const OverflowBox(
11+
minWidth: 0,
12+
minHeight: 0,
13+
maxWidth: double.infinity,
14+
maxHeight: double.infinity,
15+
child: SizedBox(
16+
width: 100,
17+
height: 100,
18+
child: Image(image: AssetImage('assets/images/meow.gif')),
19+
),
20+
);
21+
}

example/lib/src/app/view_app.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ export 'view/menu/radio_material.dart';
1212

1313
// Color picker routine
1414
export 'view/color_picker.dart';
15+
16+
// Splash Screen
17+
export 'view/splash_screen.dart';

example/lib/src/main/controller/counter_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import '/src/model.dart';
55

66
import '/src/view.dart';
77

8-
class CounterController extends AppController {
8+
class CounterController extends AppStateXController {
99
factory CounterController() => _this ??= CounterController._();
1010
CounterController._() : super() {
1111
//

example/lib/src/main/grid_app_example/gridview/images/view/random_cat.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ class _RandomCatState extends ImageAPIStateX<RandomCat> {
2929
path: 'api/v2/random/animal/cat',
3030
),
3131
);
32+
33+
/// Supply a 'splash screen' while the FutureBuilder is processing.
34+
@override
35+
Widget? onSplashScreen(BuildContext context) => const SplashScreen();
3236
}

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ packages:
312312
path: ".."
313313
relative: true
314314
source: path
315-
version: "5.5.0"
315+
version: "5.6.0"
316316
fuchsia_remote_debug_protocol:
317317
dependency: transitive
318318
description: flutter

0 commit comments

Comments
 (0)