Merge pull request #375 from Pualoo/fix_docbanner

fix: DocBanner overflow issue: #354
This commit is contained in:
Nathan.fooo 2022-02-24 11:58:33 +08:00 committed by GitHub
commit aa77d52b58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,43 +16,44 @@ class DocBanner extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = context.watch<AppTheme>(); final theme = context.watch<AppTheme>();
// [[Row]] CrossAxisAlignment vs mainAxisAlignment
// https://stackoverflow.com/questions/53850149/flutter-crossaxisalignment-vs-mainaxisalignment
return ConstrainedBox( return ConstrainedBox(
constraints: const BoxConstraints(minHeight: 60), constraints: const BoxConstraints(minHeight: 60),
child: Container( child: Container(
width: double.infinity,
color: theme.main1, color: theme.main1,
child: Row( child: FittedBox(
children: [ alignment: Alignment.center,
FlowyText.medium(LocaleKeys.deletePagePrompt_text.tr(), color: Colors.white), fit: BoxFit.scaleDown,
const HSpace(20), child: Row(
BaseStyledButton( children: [
minWidth: 160, FlowyText.medium(LocaleKeys.deletePagePrompt_text.tr(), color: Colors.white),
minHeight: 40, const HSpace(20),
contentPadding: EdgeInsets.zero, BaseStyledButton(
bgColor: Colors.transparent, minWidth: 160,
hoverColor: theme.main2, minHeight: 40,
downColor: theme.main1, contentPadding: EdgeInsets.zero,
outlineColor: Colors.white, bgColor: Colors.transparent,
borderRadius: Corners.s8Border, hoverColor: theme.main2,
child: FlowyText.medium(LocaleKeys.deletePagePrompt_restore.tr(), color: Colors.white, fontSize: 14), downColor: theme.main1,
onPressed: onRestore), outlineColor: Colors.white,
const HSpace(20), borderRadius: Corners.s8Border,
BaseStyledButton( child: FlowyText.medium(LocaleKeys.deletePagePrompt_restore.tr(), color: Colors.white, fontSize: 14),
minWidth: 220, onPressed: onRestore),
minHeight: 40, const HSpace(20),
contentPadding: EdgeInsets.zero, BaseStyledButton(
bgColor: Colors.transparent, minWidth: 220,
hoverColor: theme.main2, minHeight: 40,
downColor: theme.main1, contentPadding: EdgeInsets.zero,
outlineColor: Colors.white, bgColor: Colors.transparent,
borderRadius: Corners.s8Border, hoverColor: theme.main2,
child: FlowyText.medium(LocaleKeys.deletePagePrompt_deletePermanent.tr(), downColor: theme.main1,
color: Colors.white, fontSize: 14), outlineColor: Colors.white,
onPressed: onDelete), borderRadius: Corners.s8Border,
], child: FlowyText.medium(LocaleKeys.deletePagePrompt_deletePermanent.tr(),
crossAxisAlignment: CrossAxisAlignment.center, color: Colors.white, fontSize: 14),
mainAxisAlignment: MainAxisAlignment.center, onPressed: onDelete),
],
),
), ),
), ),
); );