diff --git a/README.md b/README.md index 8ece59c..2ff6e00 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ flutter_controls_core: git: url: https://github.com/fermi-ad/flutter-controls-core.git tag_pattern: v{{version}} - version: ^1.3.0 + version: ^1.4.0 ``` _NOTE:_ This project is under very active development so calling this the @@ -54,12 +54,14 @@ dependencies: flutter_gql_acsys: git: url: https://github.com/fermi-ad/flutter-gql-acsys.git - ref: main + tag_pattern: v{{version}} + version: ^1.1.0 flutter_controls_core: git: url: https://github.com/fermi-ad/flutter-controls-core.git - ref: main + tag_pattern: v{{version}} + version: ^1.4.0 ``` and where your application constructs the `StandardApp`, you specify the diff --git a/lib/src/app_scaffold.dart b/lib/src/app_scaffold.dart index d936576..e4d6dc7 100644 --- a/lib/src/app_scaffold.dart +++ b/lib/src/app_scaffold.dart @@ -407,6 +407,8 @@ final class StandardApp extends StatelessWidget { /// is set up and the drawer will show "No login required". final AuthInfo? authInfo; + final bool selectable; + StandardApp({ required this.title, this.model, @@ -419,6 +421,7 @@ final class StandardApp extends StatelessWidget { List? neededRoles, this.themeMode = ThemeMode.system, this.useBison = false, + this.selectable = false, super.key, }) : _neededRoles = neededRoles?.toSet() ?? {}; @@ -469,7 +472,9 @@ final class StandardApp extends StatelessWidget { theme: theme.light, darkTheme: theme.dark, themeMode: themeMode, - home: ToastificationWrapper(child: SelectionArea(child: scaffold)), + home: ToastificationWrapper( + child: selectable ? SelectionArea(child: scaffold) : scaffold, + ), ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 74cdc35..f398bd6 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.4.0 +version: 1.4.1 publish_to: none environment: diff --git a/test/widget/app_scaffold_test.dart b/test/widget/app_scaffold_test.dart index 73d16d3..ef07723 100644 --- a/test/widget/app_scaffold_test.dart +++ b/test/widget/app_scaffold_test.dart @@ -119,4 +119,31 @@ void main() { expect(find.text('no-model'), findsOneWidget); }); }); + + group('StandardApp text selection', () { + testWidgets('text is selectable by default', (tester) async { + await tester.pumpWidget(StandardApp(title: 'T', body: const Text('x'))); + expect(find.byType(SelectionArea), findsNothing); + }); + + testWidgets('selectable: false leaves out the SelectionArea', ( + tester, + ) async { + await tester.pumpWidget( + StandardApp(title: 'T', selectable: false, body: const Text('x')), + ); + expect(find.byType(SelectionArea), findsNothing); + expect(find.text('x'), findsOneWidget); + }); + + testWidgets('selectable: true adds the SelectionArea', ( + tester, + ) async { + await tester.pumpWidget( + StandardApp(title: 'T', selectable: true, body: const Text('x')), + ); + expect(find.byType(SelectionArea), findsOneWidget); + expect(find.text('x'), findsOneWidget); + }); + }); }