Skip to content

Commit

Permalink
feat: platform back button add
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Nov 4, 2022
1 parent 1f8ce0f commit 682feb1
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/platform_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export 'src/platform_text.dart';
export 'src/platform_alert_dialog.dart';
export 'src/platform_checkbox.dart';
export 'src/platform_builder.dart';
export 'src/platform_back_button.dart';
50 changes: 50 additions & 0 deletions lib/src/platform_back_button.dart
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);
}
}
4 changes: 2 additions & 2 deletions lib/src/platform_drop_down_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class _PlatformDropDownMenuState<T> extends State<PlatformDropDownMenu<T>>
mainAxisSize: MainAxisSize.min,
children: [
widget.items[index].ios(),
const SizedBox(width: 8),
const Icon(CupertinoIcons.chevron_down_circle),
const SizedBox(width: 4),
const Icon(CupertinoIcons.chevron_down),
],
),
onPressed: () {
Expand Down
1 change: 1 addition & 0 deletions lib/src/platform_slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class PlatformSlider extends StatelessWidget with PlatformMixin<Widget> {
inactiveColor: inactiveColor != null
? FluentUI.ButtonState.all(inactiveColor)
: null,
margin: const EdgeInsets.all(8),
),
mouseCursor: mouseCursor,
focusNode: focusNode,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/specific/cupertino_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class CupertinoListTile extends StatelessWidget {

if (selected) return theme.primaryColor;

return null;
return theme.primaryColor;
}

Color? _textColor(BuildContext context, PlatformThemeData theme,
Expand Down

0 comments on commit 682feb1

Please sign in to comment.