我怎样才能改变flutter中的CupertinoActionSheet
背景颜色?我尝试了很多可能的方法。但是它的默认颜色没有改变。我该怎么做?
样品代码:
import 'package:flutter/cupertino.dart';
import 'package:service/services/page_navigation_service.dart';
import 'package:service/view/variables/colors_variable.dart';
import 'package:service/view/variables/text_style.dart';
class MyCupertinoBottomSheet extends StatelessWidget {
final Widget child;
final String? title;
const MyCupertinoBottomSheet({Key? key, required this.child, this.title})
: super(key: key);
@override
Widget build(BuildContext context) {
return CupertinoActionSheet(
title: Text(
title ?? "",
style: CustomTextStyle.titleBoldStyleDarkGrey,
),
message: Container(
padding: const EdgeInsets.all(16.0),
// height: MediaQuery.of(context).size.height * 0.5,
decoration: const BoxDecoration(
color: CustomColors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0),
topRight: Radius.circular(16.0),
),
),
child: child,
),
actions: [
CupertinoActionSheetAction(
onPressed: () {
PageNavigationService.backScreen();
},
child: const Text('CONFIRM',
style: CustomTextStyle.mediumBoldStylePrimary),
),
CupertinoActionSheetAction(
onPressed: () {
PageNavigationService.backScreen();
},
child: const Text(
'CLOSE',
style: CustomTextStyle.mediumBoldStyleDarkGrey,
),
),
],
);
}
}
我也用了Material
,CupertinoTheme
,但都不管用。
1条答案
按热度按时间wqlqzqxt1#
使用cupertinoTheme Package 您的CupertinoActionSheet,如下所示