banner.dart 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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:app_flowy/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. downColor: Theme.of(context).colorScheme.primaryContainer,
  36. outlineColor: Colors.white,
  37. borderRadius: Corners.s8Border,
  38. onPressed: onRestore,
  39. child: FlowyText.medium(
  40. LocaleKeys.deletePagePrompt_restore.tr(),
  41. color: Theme.of(context).colorScheme.onPrimary,
  42. fontSize: 14,
  43. )),
  44. const HSpace(20),
  45. BaseStyledButton(
  46. minWidth: 220,
  47. minHeight: 40,
  48. contentPadding: EdgeInsets.zero,
  49. bgColor: Colors.transparent,
  50. hoverColor: Theme.of(context).colorScheme.primaryContainer,
  51. downColor: Theme.of(context).colorScheme.primary,
  52. outlineColor: Colors.white,
  53. borderRadius: Corners.s8Border,
  54. onPressed: onDelete,
  55. child: FlowyText.medium(
  56. LocaleKeys.deletePagePrompt_deletePermanent.tr(),
  57. color: Theme.of(context).colorScheme.onPrimary,
  58. fontSize: 14,
  59. )),
  60. ],
  61. ),
  62. ),
  63. ),
  64. );
  65. }
  66. }