banner.dart 2.5 KB

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