-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:macos_ui/macos_ui.dart'; | ||
import 'package:platform_ui/platform_ui.dart'; | ||
|
||
class PlatformBackButton extends StatelessWidget with PlatformMixin<Widget> { | ||
final Color? color; | ||
final VoidCallback? onPressed; | ||
const PlatformBackButton({Key? key, this.color, this.onPressed}) | ||
: super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return getPlatformType(context); | ||
} | ||
|
||
@override | ||
Widget android(BuildContext context) { | ||
return BackButton( | ||
color: color, | ||
onPressed: onPressed, | ||
); | ||
} | ||
|
||
@override | ||
Widget ios(BuildContext context) { | ||
return CupertinoNavigationBarBackButton( | ||
color: color, | ||
onPressed: onPressed, | ||
); | ||
} | ||
|
||
@override | ||
Widget linux(BuildContext context) { | ||
return android(context); | ||
} | ||
|
||
@override | ||
Widget macos(BuildContext context) { | ||
return MacosBackButton( | ||
fillColor: color, | ||
onPressed: onPressed, | ||
); | ||
} | ||
|
||
@override | ||
Widget windows(BuildContext context) { | ||
return android(context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters