keyboard_top_button.dart 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:photos/theme/ente_theme.dart';
  4. class KeyboardTopButton extends StatelessWidget {
  5. final Function? onDoneTap;
  6. final Function? onCancelTap;
  7. final String doneText;
  8. final String cancelText;
  9. const KeyboardTopButton({
  10. super.key,
  11. this.doneText = "Done",
  12. this.cancelText = "Cancel",
  13. this.onDoneTap,
  14. this.onCancelTap,
  15. });
  16. @override
  17. Widget build(BuildContext context) {
  18. final enteTheme = getEnteTextTheme(context);
  19. final colorScheme = getEnteColorScheme(context);
  20. return Container(
  21. width: double.infinity,
  22. decoration: BoxDecoration(
  23. border: Border(
  24. top: BorderSide(width: 1.0, color: colorScheme.strokeFaint),
  25. bottom: BorderSide(width: 1.0, color: colorScheme.strokeFaint),
  26. ),
  27. color: colorScheme.backgroundElevated2,
  28. ),
  29. child: Padding(
  30. padding: const EdgeInsets.symmetric(horizontal: 10.0),
  31. child: Row(
  32. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  33. children: [
  34. CupertinoButton(
  35. padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
  36. onPressed: () {
  37. onCancelTap?.call();
  38. },
  39. child: Text(cancelText, style: enteTheme.bodyBold),
  40. ),
  41. CupertinoButton(
  42. padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
  43. onPressed: () {
  44. onDoneTap?.call();
  45. },
  46. child: Text(doneText, style: enteTheme.bodyBold),
  47. ),
  48. ],
  49. ),
  50. ),
  51. );
  52. }
  53. }