diff --git a/README.md b/README.md index 1659ede..e554c03 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,10 @@ to your application, add this dependency to your `pubspec.yaml` file: ```yaml flutter_controls_core: - git: - url: https://github.com/fermi-ad/flutter-controls-core.git - ref: main + git: + url: https://github.com/fermi-ad/flutter-controls-core.git + tag_pattern: v{{version}} + version: ^1.2.0 ``` _NOTE:_ This project is under very active development so calling this the diff --git a/lib/src/app_scaffold.dart b/lib/src/app_scaffold.dart index 547944f..ce0dca8 100644 --- a/lib/src/app_scaffold.dart +++ b/lib/src/app_scaffold.dart @@ -211,18 +211,14 @@ final class _DrawerHeaderState extends State<_DrawerHeader> { null, ), - (null, true) => _buildAuthHeader( - Icons.no_accounts_sharp, - "Unauthorized", - ( + (null, true) => + _buildAuthHeader(Icons.no_accounts_sharp, "Unauthorized", ( "Login", () => closeDrawerThen(() { infoBox(context, "Log in", "Contacting KeyCloak ..."); AuthService.requestLogin(context); }), - ), - _buildMissingRolesWarning(context, widget.neededRoles), - ), + ), _buildMissingRolesWarning(context, widget.neededRoles)), (UserInfo user, true) => _buildAuthHeader( Icons.account_circle, @@ -439,35 +435,32 @@ final class StandardApp extends StatelessWidget { // Build the base scaffold for the application. We don't just return it // because it may need to be "wrapped" in other widgets. - Widget tmpScaffold = Scaffold( + Widget scaffold = Scaffold( appBar: appBar, body: body, drawer: _Drawer(drawerContent, authInfo, _neededRoles), floatingActionButton: floatingActionButton, ); - // Wrap the scaffold with the AuthService if authentication is being used. - // This is done here so that the AuthService is below the providers and - // global state. This is important because when you log in and log out, the - // providers and global state will reinitialize. + // Iterate over the list of providers, wrapping -- and eventually returning + // -- the accumulated widgets around the base scaffold. + + scaffold = providers.fold(scaffold, (w, p) => p(child: w)); + + // Wrap with the AuthService if authentication is being used. This is done + // here so that the providers can use the AuthService to access the current + // user and their JWT. if (authInfo != null) { - tmpScaffold = AuthService(authInfo: authInfo!, child: tmpScaffold); + scaffold = AuthService(authInfo: authInfo!, child: scaffold); } // Now wrap the scaffold with any global state used by the application. if (model != null) { - tmpScaffold = _GlobalStateProvider(model: model!, child: tmpScaffold); + scaffold = _GlobalStateProvider(model: model!, child: scaffold); } - // Iterate over the list of providers, wrapping -- and eventually returning - // -- the accumulated widgets. We need the AuthService to be below the - // providers because when you log in and log out, the providers will - // restart their data aquisition. - - final scaffold = providers.fold(tmpScaffold, (w, p) => p(child: w)); - final theme = _resolveTheme(useBison); return MaterialApp( diff --git a/pubspec.yaml b/pubspec.yaml index a5a1899..48aa469 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_controls_core description: A Flutter package to write Fermilab applications. -version: 1.2.4 +version: 1.2.5 publish_to: none environment: