Skip to content

Commit

Permalink
Highlight searched gas price on page details
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabi755 committed Nov 13, 2022
1 parent 124872d commit 15ad451
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 17 deletions.
5 changes: 4 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {
context,
MaterialPageRoute(
builder: (context) => StationDetailsPage(
stationId: s.id, stationName: s.label)));
stationId: s.id,
stationName: s.label,
activeGasPriceFilter: _filter.gas,
)));
},
icon: await _genMarkerBitmap(s))));
return markers.toSet();
Expand Down
81 changes: 65 additions & 16 deletions station/lib/details/station_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import 'package:station/station_model.dart';
class StationDetailsPage extends StatelessWidget {
final String stationId;
final String? stationName;
final String? activeGasPriceFilter;

const StationDetailsPage(
{required this.stationId, this.stationName, Key? key})
{required this.stationId,
this.stationName,
this.activeGasPriceFilter,
Key? key})
: super(key: key);

@override
Expand Down Expand Up @@ -105,13 +109,28 @@ class StationDetailsPage extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Expanded(
flex: 2, child: Text("Super E5")),
Expanded(
flex: 2,
child: Text("Super E5",
style: TextStyle(
fontWeight:
activeGasPriceFilter ==
"e5"
? FontWeight.bold
: FontWeight
.normal))),
Expanded(
flex: 1,
child: Text(_priceText(
station.prices.e5,
station.isOpen))),
child: Text(
_priceText(station.prices.e5,
station.isOpen),
style: TextStyle(
fontWeight:
activeGasPriceFilter ==
"e5"
? FontWeight.bold
: FontWeight
.normal))),
],
)),
Padding(
Expand All @@ -120,13 +139,28 @@ class StationDetailsPage extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Expanded(
flex: 2, child: Text("Super E10")),
Expanded(
flex: 2,
child: Text("Super E10",
style: TextStyle(
fontWeight:
activeGasPriceFilter ==
"e10"
? FontWeight.bold
: FontWeight
.normal))),
Expanded(
flex: 1,
child: Text(_priceText(
station.prices.e10,
station.isOpen))),
child: Text(
_priceText(station.prices.e10,
station.isOpen),
style: TextStyle(
fontWeight:
activeGasPriceFilter ==
"e10"
? FontWeight.bold
: FontWeight
.normal))),
],
)),
Padding(
Expand All @@ -135,13 +169,28 @@ class StationDetailsPage extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Expanded(
flex: 2, child: const Text("Diesel")),
Expanded(
flex: 2,
child: Text("Diesel",
style: TextStyle(
fontWeight:
activeGasPriceFilter ==
"diesel"
? FontWeight.bold
: FontWeight
.normal))),
Expanded(
flex: 1,
child: Text(_priceText(
station.prices.diesel,
station.isOpen))),
child: Text(
_priceText(station.prices.diesel,
station.isOpen),
style: TextStyle(
fontWeight:
activeGasPriceFilter ==
"diesel"
? FontWeight.bold
: FontWeight
.normal))),
],
))
]))),
Expand Down

0 comments on commit 15ad451

Please sign in to comment.