fabCreateAccount.dart 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import 'dart:math' as math;
  2. import 'package:flutter/material.dart';
  3. import 'package:photos/ente_theme_data.dart';
  4. class FABCreateAccount extends StatelessWidget {
  5. final bool isKeypadOpen;
  6. final bool isFormValid;
  7. final String buttonText;
  8. final Function onPressedFunction;
  9. const FABCreateAccount(
  10. {this.isKeypadOpen,
  11. this.buttonText,
  12. this.isFormValid,
  13. this.onPressedFunction});
  14. @override
  15. Widget build(BuildContext context) {
  16. if (isKeypadOpen) {
  17. //var here
  18. return Container(
  19. decoration: BoxDecoration(
  20. boxShadow: [
  21. BoxShadow(
  22. color: Theme.of(context).backgroundColor,
  23. spreadRadius: 200,
  24. blurRadius: 100,
  25. offset: Offset(0, 230),
  26. )
  27. ],
  28. ),
  29. width: double.infinity,
  30. child: Row(
  31. mainAxisAlignment: MainAxisAlignment.end,
  32. children: [
  33. FloatingActionButton(
  34. //mini: true,
  35. backgroundColor:
  36. Theme.of(context).colorScheme.fabBackgroundColor,
  37. foregroundColor:
  38. Theme.of(context).colorScheme.fabTextOrIconColor,
  39. child: Transform.rotate(
  40. angle: isFormValid ? 0 : math.pi / 2, //var here
  41. child: Icon(
  42. Icons.chevron_right,
  43. size: 36,
  44. ),
  45. ),
  46. onPressed: isFormValid
  47. ? onPressedFunction
  48. : () {
  49. FocusScope.of(context).unfocus();
  50. } //keypad down here
  51. ),
  52. ],
  53. ),
  54. );
  55. } else {
  56. return Container(
  57. width: double.infinity,
  58. height: 56,
  59. padding: EdgeInsets.symmetric(horizontal: 20),
  60. child: OutlinedButton(
  61. //style: Theme.of(context).elevatedButtonTheme.style,
  62. onPressed: isFormValid //var here
  63. ? onPressedFunction
  64. : null,
  65. child: Text(buttonText),
  66. ),
  67. );
  68. }
  69. }
  70. }