banner.dart 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:easy_localization/easy_localization.dart';
  2. import 'package:flowy_infra/size.dart';
  3. import 'package:flowy_infra/theme.dart';
  4. import 'package:flowy_infra_ui/style_widget/text.dart';
  5. import 'package:flowy_infra_ui/widget/buttons/base_styled_button.dart';
  6. import 'package:flowy_infra_ui/widget/spacing.dart';
  7. import 'package:flutter/material.dart';
  8. import 'package:provider/provider.dart';
  9. import 'package:app_flowy/generated/locale_keys.g.dart';
  10. class DocumentBanner extends StatelessWidget {
  11. final void Function() onRestore;
  12. final void Function() onDelete;
  13. const DocumentBanner({required this.onRestore, required this.onDelete, Key? key}) : super(key: key);
  14. @override
  15. Widget build(BuildContext context) {
  16. final theme = context.watch<AppTheme>();
  17. return ConstrainedBox(
  18. constraints: const BoxConstraints(minHeight: 60),
  19. child: Container(
  20. width: double.infinity,
  21. color: theme.main1,
  22. child: FittedBox(
  23. alignment: Alignment.center,
  24. fit: BoxFit.scaleDown,
  25. child: Row(
  26. children: [
  27. FlowyText.medium(LocaleKeys.deletePagePrompt_text.tr(), color: Colors.white),
  28. const HSpace(20),
  29. BaseStyledButton(
  30. minWidth: 160,
  31. minHeight: 40,
  32. contentPadding: EdgeInsets.zero,
  33. bgColor: Colors.transparent,
  34. hoverColor: theme.main2,
  35. downColor: theme.main1,
  36. outlineColor: Colors.white,
  37. borderRadius: Corners.s8Border,
  38. child: FlowyText.medium(LocaleKeys.deletePagePrompt_restore.tr(), color: Colors.white, fontSize: 14),
  39. onPressed: onRestore),
  40. const HSpace(20),
  41. BaseStyledButton(
  42. minWidth: 220,
  43. minHeight: 40,
  44. contentPadding: EdgeInsets.zero,
  45. bgColor: Colors.transparent,
  46. hoverColor: theme.main2,
  47. downColor: theme.main1,
  48. outlineColor: Colors.white,
  49. borderRadius: Corners.s8Border,
  50. child: FlowyText.medium(LocaleKeys.deletePagePrompt_deletePermanent.tr(),
  51. color: Colors.white, fontSize: 14),
  52. onPressed: onDelete),
  53. ],
  54. ),
  55. ),
  56. ),
  57. );
  58. }
  59. }