Skip to content

Commit

Permalink
4.19.0
Browse files Browse the repository at this point in the history
Took 5 hours 26 minutes
  • Loading branch information
Drawner committed Jul 10, 2024
1 parent fc3e0f6 commit ef04fa7
Show file tree
Hide file tree
Showing 19 changed files with 776 additions and 444 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

## 4.19.0
July 10, 2024
- AppState.detachedAppLifecycleState() 'attempts' to call State object's deactivate() and dispose()
- AppState.didChangeAppLifecycleState() encompasses life cycle event flags.
- Renamed event flags: inactive, hidden, paused, resumed, detached to
_inactiveAppLifecycle, _hiddenAppLifecycle, _pausedAppLifecycle, _resumedAppLifecycle, _detachedAppLifecycle
- Renamed the functions:
inactiveAppLifecycle(), hiddenAppLifecycle(), pausedAppLifecycle(), resumedAppLifecycle(), detachedAppLifecycle()
- Removed @protected from methods to be used outside an instance member's subclasses:

## 4.18.0
June 15, 2024
- getter usingCupertino assigned a local variable
Expand Down
18 changes: 9 additions & 9 deletions example/integration_test/test_example_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Future<void> integrationTesting(WidgetTester tester) async {
}

/// This should be the 'latest' State object running in the App
expect(state.isEndState, isTrue, reason: _location);
expect(state.isLastState, isTrue, reason: _location);

/// Go to Page 1
await tester.tap(find.byKey(const Key('Page 1')));
Expand Down Expand Up @@ -105,26 +105,26 @@ Future<void> integrationTesting(WidgetTester tester) async {
expect(event, isTrue, reason: _location);
}

event = state.paused;
event = state.pausedAppLifecycle;

if (event) {
/// The app has been paused
expect(event, isTrue, reason: _location);
}

event = state.inactive;
event = state.inactiveAppLifecycle;

if (event) {
expect(event, isTrue, reason: _location);
}

event = state.detached;
event = state.detachedAppLifecycle;

if (event) {
expect(event, isTrue, reason: _location);
}

event = state.resumed;
event = state.resumedAppLifecycle;

if (event) {
expect(event, isTrue, reason: _location);
Expand All @@ -146,9 +146,9 @@ Future<void> integrationTesting(WidgetTester tester) async {
expect(event, isTrue, reason: _location);
}

if (!state.hidden) {
if (!state.hiddenAppLifecycle) {
// Should not happen, but don't trip it here regardless! gp
expect(state.hidden, isFalse, reason: _location);
expect(state.hiddenAppLifecycle, isFalse, reason: _location);
}

if (!state.mounted) {
Expand Down Expand Up @@ -181,11 +181,11 @@ Future<void> integrationTesting(WidgetTester tester) async {
await tester.pumpAndSettle(const Duration(milliseconds: 200));

// Test the controllers move across different State objects.
state = con.state!.startState as StateX;
state = con.state!.firstState as StateX;

expect(state, isA<AppStateX>(), reason: _location);

state = con.state!.endState as StateX;
state = con.state!.lastState as StateX;

expect(state, isA<Page2State>(), reason: _location);

Expand Down
8 changes: 5 additions & 3 deletions example/lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

export 'package:example/src/another_app/controller.dart';
export '/src/another_app/controller.dart';

export 'package:example/src/controller/app/app_controller.dart';
export '/src/controller/app/app_controller.dart';

export 'package:example/src/controller/home/_controller.dart';
export '/src/controller/app/common/events_controller.dart';

export '/src/controller/home/_controller.dart';
69 changes: 4 additions & 65 deletions example/lib/src/controller/app/app_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:example/src/view.dart';
import '/src/controller.dart';

import '/src/view.dart';

/// The 'App Level' Controller
class ExampleAppController extends StateXController {
class ExampleAppController extends StateXController with EventsControllerMixin {
/// Singleton design pattern is best for Controllers.
factory ExampleAppController() => _this ??= ExampleAppController._();
ExampleAppController._();
Expand Down Expand Up @@ -37,67 +39,4 @@ class ExampleAppController extends StateXController {

/// Allow for a Splash screen or not
bool splashScreen = false;

/// The framework will call this method exactly once.
/// Only when the [StateX] object is first created.
@override
void initState() {
super.initState();
if (inDebugMode) {
//ignore: avoid_print
print('############ Event: initState in $state');
}
}

/// The framework calls this method whenever this [StateX] object is closed.
@override
void deactivate() {
if (inDebugMode) {
//ignore: avoid_print
print('############ Event: deactivate in $state');
}
}

/// Called when this object was [deactivate].
/// Rarely actually called but good to have since was deactivated.
/// You may have to undo what was done in [deactivate].
/// It was removed from the widget tree for some reason but re-inserted again.
@override
void activate() {
if (inDebugMode) {
//ignore: avoid_print
print('############ Event: activate in $state');
}
}

/// The framework calls this method when this [StateX] object will be garbage collected
/// Note: YOU HAVE NO IDEA WHEN THIS WILL RUN in the Framework.
/// USE [deactivate] for time critical operations.[dispose] for light cleanup.
@override
void dispose() {
if (inDebugMode) {
//ignore: avoid_print
print('############ Event: dispose in $state');
}
super.dispose();
}

/// The application is not currently visible to the user, not responding to
/// user input, and running in the background.
@override
void pausedLifecycleState() {
if (inDebugMode) {
//ignore: avoid_print
print('############ Event: pausedLifecycleState in $state');
}
}

/// The application is visible and responding to user input.
@override
void resumedLifecycleState() {
if (inDebugMode) {
//ignore: avoid_print
print('############ Event: resumedLifecycleState in $state');
}
}
}
Loading

0 comments on commit ef04fa7

Please sign in to comment.