mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
Added loading and success icons to login button
This commit is contained in:
51
lib/features/shared_widgets/default_button.dart
Normal file
51
lib/features/shared_widgets/default_button.dart
Normal file
@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class DefaultButton extends StatelessWidget {
|
||||
const DefaultButton({
|
||||
super.key,
|
||||
this.enabled = true,
|
||||
this.onPressed,
|
||||
this.child,
|
||||
this.isSecondary = false,
|
||||
this.text,
|
||||
});
|
||||
|
||||
final void Function()? onPressed;
|
||||
final Widget? child;
|
||||
|
||||
final String? text;
|
||||
final bool isSecondary;
|
||||
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: enabled ? onPressed : null,
|
||||
style: isSecondary
|
||||
? null
|
||||
: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
enabled ? ColorsManager.primaryColor : Colors.grey),
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: text != null
|
||||
? Text(
|
||||
text!,
|
||||
style: TextStyle(
|
||||
color: isSecondary
|
||||
? Colors.black
|
||||
: enabled
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
)
|
||||
: child,
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user