InactiveBehaviorenum to control whether the widget returned by [AppLock.inactiveBuilder] is shown only when [AppLock] is enabled or whether it should always been shown
Thank you to @yamashita-room-335 for the interest in the inactive state!
NOTE: Use 4.2.0 or 4.2.0+2 only as 4.2.0+1 was mistakenly published from a WIP branch
- Ability to change the background lock latency from a descendant using
AppLock.of(context).setBackgroundLockLatency(duration);(closes pull request #27) - Deprecation:
enabledis now deprecated and will be removed in the next major versions, please useinitiallyEnabledinstead (provides clarity based on discussion on pull request #27) - Deprecation:
backgroundLockLatencyis now deprecated and will be removed in the next major versions, please useinitalBackgroundLockLatencyinstead (provides clarity based on discussion on pull request #27)
Thank you to @jakobleck and @Bptmn for helping to drive this forward through an initial pull request, suggestions and conversation!
- Due to an admin error, 4.2.0+1 was meant to only contain documentation updates but instead was published with a WIP rewrite at this git commit
- Exact same code as 4.2.0+2 above just without all of the documentation updates
- Updates to README
- Fix for app still locking if the app resumes before the end of the background lock latency
- Inactive state!
- When the app becomes inactive (e.g. viewing the device's recent app switcher or notification center) you can now show a custom screen (see issue #6 for limitations)
- This can be used instead of or along side the existing lock screen mechanism
- Deprecation:
lockScreenis now deprecated and will be removed in the next major version, please uselockScreenBuilderinstead (closes issue #23)
- Breaking change: requires Flutter 3.16.0 or greater
- Breaking change: requires Dart 3.0.0 or greater
- Using
AppLifecycleState.hiddeninstead ofAppLifecycleState.paused - Package upgrades and deprecation fixes
Version 4.0.0 general availabilty, see changes in 4.0.0-dev.0 - 21st November 2022 below.
MaterialApp is no longer used under the hood!
Version 4.0.0 uses a Navigator directly instead of a MaterialApp. The new required use of AppLock allows you to make use of your own MaterialApp's theming.
Old:
void main() {
runApp(AppLock(
builder: (arg) => MyApp(data: arg),
lockScreen: LockScreen(),
));
}New:
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
...
@override
Widget build(BuildContext context) {
return MaterialApp(
...
builder: (context, child) => AppLock(
builder: (context, arg) => child!,
lockScreen: LockScreen(),
),
...
);
}
}Breaking changes:
buildernow requires a callback which receives aBuildContextand anObject?themeis no longer available
Non-breaking changes:
AppLocknow exposes alaunchArgproperty which is anObject?
Flutter 3 support!
Flutter 3 was always supported, but the ! operator has been removed from calls to WidgetsBinding.instance which was causing an annoying warning.
All packages have been upgraded and the example project has also been upgraded.
Migrated to null-safety!
There are now also integration tests in the example project which can be run using flutter test integration_test/integration_tests.dart.
Added the ability to override the theme property of the MaterialApp which AppLock uses internally.
runApp(AppLock(
...
theme: ThemeData(
textTheme: TextTheme(
headline1: TextStyle(fontSize: 32),
),
),
));debugShowCheckedModeBanner has also been set to false.
Thank you to @vishnukvmd and @dshukertjr for contributing these changes!
Minor updates to docs.
New functionality to specify a period of time between the app going into the background state and when the lock screen should be shown.
runApp(AppLock(
...,
backgroundLockLatency: const Duration(seconds: 30),
));This allows the app to go into the background state for the specified duration without causing the lock screen to be shown.
showLockScreen is now a Future.
await AppLock.of(context).showLockScreen();
print('Did unlock!');Thank you to @rdev-software for contributing this change!
New functionality to show the lock screen on-demand.
AppLock.of(context).showLockScreen();Update to description.
New functionality to enable or disable the lockScreen at launch and on-demand.
runApp(AppLock(
builder: ...,
lockScreen: ...,
enabled: false,
));AppLock.of(context).enable();
AppLock.of(context).disable();- Removing deprecating
childmethod in preference for thebuildermethod. - Updating Flutter version constraints
Deprecating child method in preference for the builder method - simply a name change.
Breaking change
An argument can now be passed in to the AppLock method didUnlock and is accessible through the builder method, child - this should be considered a breaking change as the builder method, child requires a parameter even if null is passed in to didUnlock.
Initial release
Use AppLock to provide lock screen functionality to you Flutter apps.