formatted the whole codebase
This commit is contained in:
@@ -15,4 +15,3 @@ class ThemeState extends Equatable {
|
||||
@override
|
||||
List<Object?> get props => [themeType];
|
||||
}
|
||||
|
||||
|
@@ -6,12 +6,12 @@ import 'package:equatable/equatable.dart';
|
||||
class AuthToken extends Equatable {
|
||||
final String accessToken;
|
||||
final DateTime expiresAt;
|
||||
|
||||
|
||||
const AuthToken({
|
||||
required this.accessToken,
|
||||
required this.expiresAt,
|
||||
});
|
||||
|
||||
|
||||
factory AuthToken.fromJson(Map<String, dynamic> json) {
|
||||
return AuthToken(
|
||||
accessToken: json['token'],
|
||||
@@ -29,7 +29,8 @@ class AuthToken extends Equatable {
|
||||
// Pad the payload if necessary
|
||||
String normalized = base64Url.normalize(payload);
|
||||
final payloadMap = json.decode(utf8.decode(base64Url.decode(normalized)));
|
||||
if (payloadMap is! Map<String, dynamic> || !payloadMap.containsKey('exp')) {
|
||||
if (payloadMap is! Map<String, dynamic> ||
|
||||
!payloadMap.containsKey('exp')) {
|
||||
throw Exception('Invalid payload');
|
||||
}
|
||||
final exp = payloadMap['exp'];
|
||||
@@ -40,9 +41,9 @@ class AuthToken extends Equatable {
|
||||
return DateTime.now().add(const Duration(hours: 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool get isExpired => DateTime.now().isAfter(expiresAt);
|
||||
|
||||
|
||||
@override
|
||||
List<Object> get props => [accessToken, expiresAt];
|
||||
}
|
||||
|
@@ -48,9 +48,9 @@ class LoginScreenState extends State<LoginScreen>
|
||||
void _submitForm() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
context.read<AuthCubit>().login(
|
||||
_customerNumberController.text.trim(),
|
||||
_passwordController.text,
|
||||
);
|
||||
_customerNumberController.text.trim(),
|
||||
_passwordController.text,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,8 @@ class LoginScreenState extends State<LoginScreen>
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
backgroundColor:
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Theme.of(context).primaryColorDark,
|
||||
side: const BorderSide(color: Colors.black, width: 1),
|
||||
elevation: 0,
|
||||
|
@@ -198,7 +198,9 @@ class _MPinScreenState extends State<MPinScreen> {
|
||||
key == '<' ? '⌫' : key,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: key == 'Enter' ? Theme.of(context).primaryColor : Colors.black,
|
||||
color: key == 'Enter'
|
||||
? Theme.of(context).primaryColor
|
||||
: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@@ -19,11 +19,8 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
|
||||
// Automatically go to logizn after 4 seconds
|
||||
Timer(const Duration(seconds: 4), () {
|
||||
|
||||
widget.onContinue();
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -73,7 +70,8 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(color: Theme.of(context).scaffoldBackgroundColor),
|
||||
child: CircularProgressIndicator(
|
||||
color: Theme.of(context).scaffoldBackgroundColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user