Redesigned Splash Screen and Login Screen

This commit is contained in:
Mohammad Salameh
2024-03-10 14:49:17 +03:00
parent ce34933738
commit a6018b282e
19 changed files with 468 additions and 218 deletions

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class DefaultButton extends StatelessWidget {
@ -6,46 +7,84 @@ class DefaultButton extends StatelessWidget {
super.key,
this.enabled = true,
this.onPressed,
this.child,
required this.child,
this.isSecondary = false,
this.text,
this.isLoading = false,
this.isDone = false,
this.customTextStyle,
this.customButtonStyle,
});
final void Function()? onPressed;
final Widget? child;
final Widget child;
final String? text;
final bool isSecondary;
final bool enabled;
final bool isDone;
final bool isLoading;
final TextStyle? customTextStyle;
final ButtonStyle? customButtonStyle;
@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),
: customButtonStyle ??
ButtonStyle(
textStyle: MaterialStateProperty.all(
customTextStyle ??
context.bodyMedium.copyWith(
fontSize: 16,
),
),
foregroundColor: MaterialStateProperty.all(
isSecondary
? Colors.black
: enabled
? Colors.white
: Colors.black,
),
backgroundColor: MaterialStateProperty.all(
enabled ? ColorsManager.primaryColor : Colors.grey),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
fixedSize: MaterialStateProperty.all(
const Size.fromHeight(50),
),
padding: MaterialStateProperty.all(
const EdgeInsets.all(10),
),
minimumSize: MaterialStateProperty.all(
const Size.fromHeight(50),
),
),
),
child: text != null
? Text(
text!,
style: TextStyle(
color: isSecondary
? Colors.black
: enabled
? Colors.white
: Colors.black,
),
)
: child,
child: SizedBox(
height: 50,
child: Center(
child: isLoading
? const SizedBox.square(
dimension: 24,
child: CircularProgressIndicator(
color: Colors.white,
),
)
: isDone
? const Icon(
Icons.check_circle_outline,
color: Colors.white,
)
: child,
),
),
);
}
}