@ -3,7 +3,9 @@ import 'package:fluffychat/pangea/widgets/pressable_button.dart';
import ' package:flutter/material.dart ' ;
import ' package:flutter/material.dart ' ;
class FullWidthButton extends StatefulWidget {
class FullWidthButton extends StatefulWidget {
final Widget title ;
final String title ;
final Widget ? icon ;
final void Function ( ) ? onPressed ;
final void Function ( ) ? onPressed ;
final bool depressed ;
final bool depressed ;
final String ? error ;
final String ? error ;
@ -13,6 +15,7 @@ class FullWidthButton extends StatefulWidget {
const FullWidthButton ( {
const FullWidthButton ( {
required this . title ,
required this . title ,
required this . onPressed ,
required this . onPressed ,
this . icon ,
this . depressed = false ,
this . depressed = false ,
this . error ,
this . error ,
this . loading = false ,
this . loading = false ,
@ -31,7 +34,7 @@ class FullWidthButtonState extends State<FullWidthButton> {
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
Padding (
Padding (
padding: EdgeInsets . fromLTRB ( 4, 4 , 4 , widget . error = = null ? 4 : 0 ) ,
padding: EdgeInsets . fromLTRB ( 6, 6 , 6 , widget . error = = null ? 6 : 0 ) ,
child: AnimatedOpacity (
child: AnimatedOpacity (
duration: FluffyThemes . animationDuration ,
duration: FluffyThemes . animationDuration ,
opacity: widget . enabled ? 1 : 0.5 ,
opacity: widget . enabled ? 1 : 0.5 ,
@ -40,40 +43,44 @@ class FullWidthButtonState extends State<FullWidthButton> {
onPressed: widget . onPressed ,
onPressed: widget . onPressed ,
borderRadius: BorderRadius . circular ( 36 ) ,
borderRadius: BorderRadius . circular ( 36 ) ,
color: Theme . of ( context ) . colorScheme . primary ,
color: Theme . of ( context ) . colorScheme . primary ,
child: Builder (
child: Container (
builder: ( context ) {
/ / internal padding
return ElevatedButton (
padding: const EdgeInsets . symmetric ( horizontal: 16 ) ,
style: ElevatedButton . styleFrom (
height: 50 ,
backgroundColor: widget . enabled
decoration: BoxDecoration (
? Theme . of ( context ) . colorScheme . primary
color: widget . enabled
: Theme . of ( context ) . disabledColor ,
? Theme . of ( context ) . colorScheme . primary
foregroundColor: Theme . of ( context ) . colorScheme . onPrimary ,
: Theme . of ( context ) . disabledColor ,
disabledForegroundColor:
borderRadius: BorderRadius . circular ( 36 ) ,
Theme . of ( context ) . colorScheme . onPrimary ,
) ,
textStyle: const TextStyle ( fontSize: 18 ) ,
child: Row (
shape: RoundedRectangleBorder (
mainAxisAlignment: MainAxisAlignment . center ,
borderRadius: BorderRadius . circular ( 36 ) ,
children: [
) ,
widget . loading
) ,
? const Expanded (
onPressed: widget . enabled
child: SizedBox (
? ( ) = > ButtonPressedNotification ( ) . dispatch ( context )
height: 18 ,
: null ,
child: Center ( child: LinearProgressIndicator ( ) ) ,
child: Row (
) ,
mainAxisAlignment: MainAxisAlignment . center ,
)
children: [
: Row (
widget . loading
mainAxisAlignment: MainAxisAlignment . center ,
? const Expanded (
children: [
child: SizedBox (
if ( widget . icon ! = null ) widget . icon ! ,
height: 18 ,
if ( widget . icon ! = null )
child:
const SizedBox ( width: 10 ) ,
Center ( child: LinearProgressIndicator ( ) ) ,
Text (
widget . title ,
style: TextStyle (
color:
Theme . of ( context ) . colorScheme . onPrimary ,
fontSize: 16 ,
) ,
) ,
)
) ,
: widget . title ,
] ,
] ,
) ,
) ,
] ,
) ;
) ,
} ,
) ,
) ,
) ,
) ,
) ,
) ,
@ -104,7 +111,6 @@ class FullWidthButtonState extends State<FullWidthButton> {
class FullWidthTextField extends StatelessWidget {
class FullWidthTextField extends StatelessWidget {
final String hintText ;
final String hintText ;
final bool autocorrect ;
final bool autocorrect ;
final bool autofocus ;
final bool obscureText ;
final bool obscureText ;
final TextInputAction ? textInputAction ;
final TextInputAction ? textInputAction ;
final TextInputType ? keyboardType ;
final TextInputType ? keyboardType ;
@ -115,7 +121,6 @@ class FullWidthTextField extends StatelessWidget {
const FullWidthTextField ( {
const FullWidthTextField ( {
required this . hintText ,
required this . hintText ,
this . autocorrect = false ,
this . autocorrect = false ,
this . autofocus = false ,
this . obscureText = false ,
this . obscureText = false ,
this . textInputAction ,
this . textInputAction ,
this . keyboardType ,
this . keyboardType ,
@ -128,11 +133,10 @@ class FullWidthTextField extends StatelessWidget {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Padding (
return Padding (
padding: const EdgeInsets . all ( 4 .0) ,
padding: const EdgeInsets . all ( 6 .0) ,
child: TextFormField (
child: TextFormField (
obscureText: obscureText ,
obscureText: obscureText ,
autocorrect: autocorrect ,
autocorrect: autocorrect ,
autofocus: autofocus ,
textInputAction: textInputAction ,
textInputAction: textInputAction ,
keyboardType: keyboardType ,
keyboardType: keyboardType ,
decoration: InputDecoration (
decoration: InputDecoration (