You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
import 'package:flutter/material.dart';
|
|
import 'package:new_recook/constants/styles.dart';
|
|
|
|
|
|
class RecookBackButton extends StatelessWidget {
|
|
final bool? white;
|
|
final bool? text;
|
|
final VoidCallback? onTap;
|
|
const RecookBackButton(
|
|
{Key? key, this.white = false, this.text = false, this.onTap})
|
|
: super(key: key);
|
|
|
|
const RecookBackButton.text(
|
|
{Key? key, this.white = false, this.text = true, this.onTap})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (Navigator.canPop(context)) {
|
|
return text??false
|
|
? MaterialButton(
|
|
minWidth:58,
|
|
padding: EdgeInsets.zero,
|
|
child: Text(
|
|
'取消',
|
|
overflow: TextOverflow.visible,
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: white??false ? Colors.white : Color(0xFF333333),
|
|
),
|
|
),
|
|
onPressed: () {
|
|
onTap == null ? Navigator.maybePop(context) : onTap!();
|
|
},
|
|
)
|
|
: IconButton(
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
size: 17,
|
|
color: white??false ? Colors.white : AppColor.blackColor,
|
|
),
|
|
onPressed: () {
|
|
onTap == null ? Navigator.maybePop(context) : onTap!();
|
|
});
|
|
} else
|
|
return SizedBox();
|
|
}
|
|
}
|