Commit e85fb87
Changed files (5)
lib
components
settings
screens
subsettings
test
ui
lib/components/settings/input_list_tile.dart
@@ -6,7 +6,7 @@ class InputListTile extends StatelessWidget {
/// Creates a list tile that allows editing a string
const InputListTile({super.key,
required this.label,
- required this.initialValue,
+ required this.value,
required this.onSubmit});
/// Short label describing the required field contents.
@@ -14,8 +14,8 @@ class InputListTile extends StatelessWidget {
/// This will be both the title of the list tile as well as the hint text in the input dialoge.
final String label;
- /// Initial content of the input field.
- final String initialValue;
+ /// Current content of the input field.
+ final String value;
/// Gets called when the user submits a new value
final void Function(String text) onSubmit;
@@ -24,13 +24,13 @@ class InputListTile extends StatelessWidget {
Widget build(BuildContext context) {
return ListTile(
title: Text(label),
- subtitle: Text(initialValue.toString()),
+ subtitle: Text(value.toString()),
trailing: const Icon(Icons.edit),
onTap: () {
showDialog(
context: context,
builder: (context) => InputDialoge(
- initialValue: initialValue,
+ initialValue: value,
hintText: label,
onSubmit: (value) {
Navigator.of(context).pop();
lib/screens/subsettings/export_import_screen.dart
@@ -75,14 +75,14 @@ class ExportImportScreen extends StatelessWidget {
children: [
InputListTile(
label: localizations.fieldDelimiter,
- initialValue: csvExportSettings.fieldDelimiter,
+ value: csvExportSettings.fieldDelimiter,
onSubmit: (value) {
csvExportSettings.fieldDelimiter = value;
},
),
InputListTile(
label: localizations.textDelimiter,
- initialValue: csvExportSettings.textDelimiter,
+ value: csvExportSettings.textDelimiter,
onSubmit: (value) {
csvExportSettings.textDelimiter = value;
},
test/ui/components/settings/color_picker_list_tile_test.dart
@@ -9,13 +9,17 @@ void main() {
testWidgets('should initialize without errors', (widgetTester) async {
await widgetTester.pumpWidget(_materialApp(ColorSelectionListTile(
title: const Text('Test'),
- onMainColorChanged: (Color value) { },
+ onMainColorChanged: (Color value) {
+ assert(false, 'should not be called');
+ },
initialColor: Colors.teal,)));
});
testWidgets('should preview color', (widgetTester) async {
await widgetTester.pumpWidget(_materialApp(ColorSelectionListTile(
title: const Text('Test'),
- onMainColorChanged: (Color value) { },
+ onMainColorChanged: (Color value) {
+ assert(false, 'should not be called');
+ },
initialColor: Colors.teal,)));
expect(find.byType(CircleAvatar), findsOneWidget);
@@ -25,7 +29,9 @@ void main() {
testWidgets('should show colorPicker on tap', (widgetTester) async {
await widgetTester.pumpWidget(_materialApp(ColorSelectionListTile(
title: const Text('Test'),
- onMainColorChanged: (Color value) { },
+ onMainColorChanged: (Color value) {
+ assert(false, 'should not be called');
+ },
initialColor: Colors.teal,)));
expect(find.byType(ColorPicker), findsNothing);
test/ui/components/settings/dropdown_list_tile_test.dart
@@ -7,7 +7,9 @@ void main() {
testWidgets('should not throw errors', (widgetTester) async {
await widgetTester.pumpWidget(_materialApp(DropDownListTile<int>(
title: const Text('test title'),
- onChanged: (int? newValue) {},
+ onChanged: (int? newValue) {
+ assert(false, 'should not be called');
+ },
items: [
for (int i = 0; i < 10; i++)
DropdownMenuItem(value: i, child: Text('option $i'))
@@ -18,7 +20,9 @@ void main() {
title: const Text('This is a very long test title.'),
subtitle: const Text('This is a very long test subtitle that should go over multiple lines.'),
leading: const Icon(Icons.add),
- onChanged: (int? newValue) {},
+ onChanged: (int? newValue) {
+ assert(false, 'should not be called');
+ },
items: [
for (int i = 0; i < 1000; i++)
DropdownMenuItem(value: i, child: Text('option $i'))
@@ -29,7 +33,9 @@ void main() {
testWidgets('should display selected option', (widgetTester) async {
await widgetTester.pumpWidget(_materialApp(DropDownListTile<int>(
title: const Text('test title'),
- onChanged: (int? newValue) {},
+ onChanged: (int? newValue) {
+ assert(false, 'should not be called');
+ },
items: [
for (int i = 0; i < 10; i++)
DropdownMenuItem(value: i, child: Text('option $i'))
test/ui/components/settings/slider_list_tile_test.dart
@@ -7,14 +7,18 @@ void main() {
testWidgets('should not throw errors', (widgetTester) async {
await widgetTester.pumpWidget(_materialApp(SliderListTile(
title: const Text('test title'),
- onChanged: (double newValue) { },
+ onChanged: (double newValue) {
+ assert(false, 'should not be called');
+ },
value: 15,
min: 1,
max: 20,
)));
await widgetTester.pumpWidget(_materialApp(SliderListTile(
title: const Text('Very long title that could overflow'),
- onChanged: (double newValue) { },
+ onChanged: (double newValue) {
+ assert(false, 'should not be called');
+ },
value: 15,
min: 1,
max: 20,