banner.dart 2.6 KB

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