-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathback_button.dart
42 lines (37 loc) · 1.17 KB
/
back_button.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:platty/src/widgets/platform.dart';
class PBackButton extends PlatformAdaptingWidget {
/// Color to set. Required on iOS, on Android it is the [IconThemeData.color].
final Color color;
/// An override callback to perform instead of the default behavior which is
/// to pop the [Navigator].
///
/// It can, for instance, be used to pop the platform's navigation stack
/// via [SystemNavigator] instead of Flutter's [Navigator] in add-to-app
/// situations.
///
/// Defaults to null.
final VoidCallback onPressed;
PBackButton(
{Key key,
@required this.color,
this.onPressed,
TargetPlatform renderPlatform})
: super(key: key, renderPlatform: renderPlatform);
@override
get renderMaterial => (BuildContext context) {
return BackButton(
color: color,
onPressed: onPressed,
);
};
@override
get renderCupertino => (BuildContext context) {
return CupertinoNavigationBarBackButton(
color: color,
onPressed: onPressed,
);
};
}