-
Notifications
You must be signed in to change notification settings - Fork 173
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
282 additions
and
78 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
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,13 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:get/get.dart'; | ||
import 'package:miru_app/main.dart'; | ||
|
||
class RouterUtils { | ||
static pop() { | ||
if (Platform.isAndroid) { | ||
return Get.back(); | ||
} | ||
return router.pop(); | ||
} | ||
} |
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,81 @@ | ||
import 'package:fluent_ui/fluent_ui.dart' as fluent; | ||
import 'package:flutter/material.dart'; | ||
import 'package:miru_app/widgets/platform_widget.dart'; | ||
|
||
class PlatformButton extends StatelessWidget { | ||
const PlatformButton({ | ||
Key? key, | ||
required this.child, | ||
this.onPressed, | ||
}) : super(key: key); | ||
final Widget child; | ||
final VoidCallback? onPressed; | ||
|
||
Widget _builaAndroidButton(BuildContext context) { | ||
return ElevatedButton(onPressed: onPressed, child: child); | ||
} | ||
|
||
Widget _builaDesktopButton(BuildContext context) { | ||
return fluent.Button(onPressed: onPressed, child: child); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return PlatformBuildWidget( | ||
androidBuilder: _builaAndroidButton, | ||
desktopBuilder: _builaDesktopButton, | ||
); | ||
} | ||
} | ||
|
||
class PlatformFilledButton extends StatelessWidget { | ||
const PlatformFilledButton({ | ||
Key? key, | ||
required this.child, | ||
this.onPressed, | ||
}) : super(key: key); | ||
final Widget child; | ||
final VoidCallback? onPressed; | ||
|
||
Widget _builaAndroidButton(BuildContext context) { | ||
return FilledButton(onPressed: onPressed, child: child); | ||
} | ||
|
||
Widget _builaDesktopButton(BuildContext context) { | ||
return fluent.FilledButton(onPressed: onPressed, child: child); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return PlatformBuildWidget( | ||
androidBuilder: _builaAndroidButton, | ||
desktopBuilder: _builaDesktopButton, | ||
); | ||
} | ||
} | ||
|
||
class PlatformTextButton extends StatelessWidget { | ||
const PlatformTextButton({ | ||
Key? key, | ||
required this.child, | ||
this.onPressed, | ||
}) : super(key: key); | ||
final Widget child; | ||
final VoidCallback? onPressed; | ||
|
||
Widget _builaAndroidButton(BuildContext context) { | ||
return TextButton(onPressed: onPressed, child: child); | ||
} | ||
|
||
Widget _builaDesktopButton(BuildContext context) { | ||
return fluent.HyperlinkButton(onPressed: onPressed, child: child); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return PlatformBuildWidget( | ||
androidBuilder: _builaAndroidButton, | ||
desktopBuilder: _builaDesktopButton, | ||
); | ||
} | ||
} |
Oops, something went wrong.