Skip to content

Commit

Permalink
Merge pull request #153 from 12fahed/main
Browse files Browse the repository at this point in the history
Discarded Destination Dropdown &
  • Loading branch information
12fahed authored Jun 26, 2024
2 parents abaff8c + 4b3e43d commit 4b53205
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 34 deletions.
3 changes: 1 addition & 2 deletions lib/new_ui/screens/railway_screen/railway_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ class _RailwayConcessionScreenState
String futurePassMessage() {
DateTime today = DateTime.now();
DateTime lastPass = lastPassIssued ?? DateTime.now();
DateTime futurePass = lastPass.add(
duration == "Monthly" ? const Duration(days: 27) : Duration(days: 87));
DateTime futurePass = lastPass.add(duration == "Monthly" ? const Duration(days: 27) : Duration(days: 87));
int diff = futurePass.difference(today).inDays;
return "You will be able to apply for a new pass after $diff days";
}
Expand Down
35 changes: 19 additions & 16 deletions lib/new_ui/screens/railway_screen/railwayform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -704,22 +704,25 @@ class _RailwayForm extends ConsumerState<RailwayForm> {
),
SizedBox(
width: MediaQuery.of(context).size.width * .45,
child: RailwayDropdownSearch(
editMode: false,
label: "To",
items: mumbaiRailwayStations,
val: toStation,
onChanged: (String? newVal) {
if (newVal != null) {
toStation = newVal;
}
},
validator: (value) {
if (value == null) {
return 'Please enter your Destination Station';
}
return null;
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"To",
style: TextStyle(
fontSize: 16.0,
color: Colors.grey,
),
),
SizedBox(height: 8.0),
Text(
toStation,
style: TextStyle(
fontSize: 18.0,
color: Colors.white,
),
),
],
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class RailwayDropdownSearch extends StatelessWidget {

@override
Widget build(BuildContext context) {
// debugPrint("RailwayDropdownSearch: $val");
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
Expand All @@ -38,7 +37,6 @@ class RailwayDropdownSearch extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 3, 12, 3),
child: DropdownSearch<String>(
//enabled: editMode,
validator: validator,
selectedItem: val,
dropdownDecoratorProps: DropDownDecoratorProps(
Expand All @@ -49,38 +47,60 @@ class RailwayDropdownSearch extends StatelessWidget {
dropdownSearchDecoration: InputDecoration(
fillColor: Colors.white,
labelText: label,
labelStyle: TextStyle(color: Colors.white),
labelStyle: TextStyle(color: Colors.grey),
border: InputBorder.none,
),
),
popupProps: PopupProps.dialog(
showSearchBox: true,
// itemBuilder: ()
searchFieldProps: TextFieldProps(
style: TextStyle(color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Theme.of(context).colorScheme.background,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: Colors.grey,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: Colors.grey,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: Colors.grey,
width: 2.0,
),
),
contentPadding: EdgeInsets.all(10),
hintText: "Search for Station",
hintStyle: TextStyle(color: Colors.grey, fontSize: 16),
),
),


itemBuilder: (context, item, isSelected) {
return Padding(
padding: const EdgeInsets.all(15.0),
child: Container(
child: Text(
item,
style: Theme.of(context)
.textTheme
.labelSmall!
.copyWith(color: Colors.white),
style: TextStyle(color: Colors.grey),
),
),
);
},
containerBuilder: (context, popupWidget) {
return Container(
color: Theme.of(context).colorScheme.background,
// color: Colors.purple,
child: popupWidget);
color: Theme.of(context).colorScheme.background,
child: popupWidget,
);
},
// itemBuilder: (context, item, isSelected) {
// return Container(
// child: Text(item),
// );
// }),
),
dropdownButtonProps: DropdownButtonProps(
icon: Icon(
Expand Down

0 comments on commit 4b53205

Please sign in to comment.