|
|
|
@ -11,7 +11,7 @@ import 'package:tuple/tuple.dart';
|
|
|
|
|
class SelectTrainSuggestions extends StatefulWidget { |
|
|
|
|
final UiDesign? uiDesign; |
|
|
|
|
final String userInput; |
|
|
|
|
final void Function(int trainNumber) onTrainSelected; |
|
|
|
|
final void Function(String trainNumber) onTrainSelected; |
|
|
|
|
|
|
|
|
|
const SelectTrainSuggestions({ Key? key, required this.uiDesign, required this.userInput, required this.onTrainSelected }) : super(key: key); |
|
|
|
|
|
|
|
|
@ -70,8 +70,8 @@ abstract class SelectTrainSuggestionsState extends State<SelectTrainSuggestions>
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String getUseCurrentInputWidgetText(int currentInput) => 'Caută trenul cu numărul $currentInput'; |
|
|
|
|
Widget getUseCurrentInputWidget(int currentInput, void Function(int) onTrainSelected); |
|
|
|
|
String getUseCurrentInputWidgetText(String currentInput) => 'Caută trenul cu numărul $currentInput'; |
|
|
|
|
Widget getUseCurrentInputWidget(String currentInput, void Function(String) onTrainSelected); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
@ -107,7 +107,7 @@ abstract class SelectTrainSuggestionsState extends State<SelectTrainSuggestions>
|
|
|
|
|
slivers: <Widget>[ |
|
|
|
|
...slivers, |
|
|
|
|
SliverToBoxAdapter( |
|
|
|
|
child: int.tryParse(userInput) != null ? getUseCurrentInputWidget(int.parse(userInput), widget.onTrainSelected) : Container(), |
|
|
|
|
child: int.tryParse(userInput) != null ? getUseCurrentInputWidget(userInput, widget.onTrainSelected) : Container(), |
|
|
|
|
), |
|
|
|
|
SliverToBoxAdapter( |
|
|
|
|
child: Container( |
|
|
|
@ -149,7 +149,7 @@ class OperatorAutocompleteSliver extends StatelessWidget {
|
|
|
|
|
final UiDesign? uiDesign; |
|
|
|
|
final String operatorName; |
|
|
|
|
final List<TrainOperatorTrainDescription> trains; |
|
|
|
|
final void Function(int) onTrainSelected; |
|
|
|
|
final void Function(String) onTrainSelected; |
|
|
|
|
|
|
|
|
|
const OperatorAutocompleteSliver({ Key? key, required this.uiDesign, required this.operatorName, required this.trains, required this.onTrainSelected }) : super(key: key); |
|
|
|
|
|
|
|
|
@ -203,7 +203,7 @@ class OperatorAutocompleteSliver extends StatelessWidget {
|
|
|
|
|
abstract class OperatorAutocompleteTile extends StatelessWidget { |
|
|
|
|
final String operatorName; |
|
|
|
|
final TrainOperatorTrainDescription train; |
|
|
|
|
final void Function(int) onTrainSelected; |
|
|
|
|
final void Function(String) onTrainSelected; |
|
|
|
|
|
|
|
|
|
const OperatorAutocompleteTile({ Key? key, required this.onTrainSelected, required this.operatorName, required this.train }) : super(key: key); |
|
|
|
|
} |
|
|
|
|