Skip to content

Commit

Permalink
[circuit] fix custom button with popups
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightDV committed May 7, 2024
1 parent c3ed4f7 commit b9746d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/Screens/circuit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class CircuitScreen extends StatelessWidget {
CircuitMapScreen(
race.circuitId,
),
isDialog: true,
),
snapshot.data!['raceResults'] != null &&
snapshot.data!['raceResults'].isNotEmpty
Expand Down Expand Up @@ -245,6 +246,7 @@ class CircuitScreen extends StatelessWidget {
CircuitMapScreen(
race.circuitId,
),
isDialog: false,
),
snapshot.data!['raceResults'] != null &&
snapshot.data!['raceResults']
Expand Down
19 changes: 13 additions & 6 deletions lib/helpers/buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ class BoxBoxButton extends StatelessWidget {
final String title;
final Icon icon;
final Widget destination;
final bool isDialog;
const BoxBoxButton(
this.title,
this.icon,
this.destination, {
this.isDialog = false,
super.key,
});

Expand Down Expand Up @@ -60,12 +62,17 @@ class BoxBoxButton extends StatelessWidget {
),
),
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => destination,
),
),
onTap: () => isDialog
? showDialog(
context: context,
builder: (BuildContext context) => destination,
)
: Navigator.push(
context,
MaterialPageRoute(
builder: (context) => destination,
),
),
),
);
}
Expand Down

0 comments on commit b9746d9

Please sign in to comment.