banner.dart 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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(
  14. {required this.onRestore, required this.onDelete, Key? key})
  15. : super(key: key);
  16. @override
  17. Widget build(BuildContext context) {
  18. final theme = context.watch<AppTheme>();
  19. return ConstrainedBox(
  20. constraints: const BoxConstraints(minHeight: 60),
  21. child: Container(
  22. width: double.infinity,
  23. color: theme.main1,
  24. child: FittedBox(
  25. alignment: Alignment.center,
  26. fit: BoxFit.scaleDown,
  27. child: Row(
  28. children: [
  29. FlowyText.medium(LocaleKeys.deletePagePrompt_text.tr(),
  30. color: Colors.white),
  31. const HSpace(20),
  32. BaseStyledButton(
  33. minWidth: 160,
  34. minHeight: 40,
  35. contentPadding: EdgeInsets.zero,
  36. bgColor: Colors.transparent,
  37. hoverColor: theme.main2,
  38. downColor: theme.main1,
  39. outlineColor: Colors.white,
  40. borderRadius: Corners.s8Border,
  41. child: FlowyText.medium(
  42. LocaleKeys.deletePagePrompt_restore.tr(),
  43. color: Colors.white,
  44. fontSize: 14),
  45. onPressed: onRestore),
  46. const HSpace(20),
  47. BaseStyledButton(
  48. minWidth: 220,
  49. minHeight: 40,
  50. contentPadding: EdgeInsets.zero,
  51. bgColor: Colors.transparent,
  52. hoverColor: theme.main2,
  53. downColor: theme.main1,
  54. outlineColor: Colors.white,
  55. borderRadius: Corners.s8Border,
  56. child: FlowyText.medium(
  57. LocaleKeys.deletePagePrompt_deletePermanent.tr(),
  58. color: Colors.white,
  59. fontSize: 14),
  60. onPressed: onDelete),
  61. ],
  62. ),
  63. ),
  64. ),
  65. );
  66. }
  67. }