banner.dart 2.6 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. return ConstrainedBox(
  19. constraints: const BoxConstraints(minHeight: 60),
  20. child: Container(
  21. width: double.infinity,
  22. color: Theme.of(context).colorScheme.primary,
  23. child: FittedBox(
  24. alignment: Alignment.center,
  25. fit: BoxFit.scaleDown,
  26. child: Row(
  27. children: [
  28. FlowyText.medium(
  29. LocaleKeys.deletePagePrompt_text.tr(),
  30. color: Colors.white,
  31. ),
  32. const HSpace(20),
  33. BaseStyledButton(
  34. minWidth: 160,
  35. minHeight: 40,
  36. contentPadding: EdgeInsets.zero,
  37. bgColor: Colors.transparent,
  38. hoverColor: Theme.of(context).colorScheme.primary,
  39. highlightColor: Theme.of(context).colorScheme.primaryContainer,
  40. outlineColor: Colors.white,
  41. borderRadius: Corners.s8Border,
  42. onPressed: onRestore,
  43. child: FlowyText.medium(
  44. LocaleKeys.deletePagePrompt_restore.tr(),
  45. color: Theme.of(context).colorScheme.onPrimary,
  46. fontSize: 14,
  47. ),
  48. ),
  49. const HSpace(20),
  50. BaseStyledButton(
  51. minWidth: 220,
  52. minHeight: 40,
  53. contentPadding: EdgeInsets.zero,
  54. bgColor: Colors.transparent,
  55. hoverColor: Theme.of(context).colorScheme.primaryContainer,
  56. highlightColor: Theme.of(context).colorScheme.primary,
  57. outlineColor: Colors.white,
  58. borderRadius: Corners.s8Border,
  59. onPressed: onDelete,
  60. child: FlowyText.medium(
  61. LocaleKeys.deletePagePrompt_deletePermanent.tr(),
  62. color: Theme.of(context).colorScheme.onPrimary,
  63. fontSize: 14,
  64. ),
  65. ),
  66. ],
  67. ),
  68. ),
  69. ),
  70. );
  71. }
  72. }