Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/src/app_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ final class StandardApp<T extends ChangeNotifier> 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,
Expand All @@ -419,6 +421,7 @@ final class StandardApp<T extends ChangeNotifier> extends StatelessWidget {
List<String>? neededRoles,
this.themeMode = ThemeMode.system,
this.useBison = false,
this.selectable = false,
super.key,
}) : _neededRoles = neededRoles?.toSet() ?? {};

Expand Down Expand Up @@ -469,7 +472,9 @@ final class StandardApp<T extends ChangeNotifier> extends StatelessWidget {
theme: theme.light,
darkTheme: theme.dark,
themeMode: themeMode,
home: ToastificationWrapper(child: SelectionArea(child: scaffold)),
home: ToastificationWrapper(
child: selectable ? SelectionArea(child: scaffold) : scaffold,
),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
27 changes: 27 additions & 0 deletions test/widget/app_scaffold_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}
Loading