-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-2928 Use default browser confirm dialog when token expired
- Loading branch information
Showing
15 changed files
with
192 additions
and
141 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
core/lib/presentation/views/dialog/confirm_dialog_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
|
||
import 'package:core/presentation/extensions/color_extension.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ConfirmDialogButton extends StatelessWidget { | ||
|
||
final String label; | ||
final double? borderRadius; | ||
final Color? backgroundColor; | ||
final EdgeInsetsGeometry? padding; | ||
final int? maxLines; | ||
final TextStyle? textStyle; | ||
final VoidCallback? onTapAction; | ||
|
||
const ConfirmDialogButton({ | ||
super.key, | ||
required this.label, | ||
this.borderRadius, | ||
this.backgroundColor, | ||
this.padding, | ||
this.maxLines, | ||
this.textStyle, | ||
this.onTapAction | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Material( | ||
type: MaterialType.transparency, | ||
child: InkWell( | ||
onTap: onTapAction, | ||
borderRadius: BorderRadius.all(Radius.circular(borderRadius ?? 10)), | ||
child: Container( | ||
width: double.infinity, | ||
height: maxLines == 1 ? 44 : null, | ||
decoration: BoxDecoration( | ||
color: backgroundColor ?? AppColor.primaryColor, | ||
borderRadius: BorderRadius.all(Radius.circular(borderRadius ?? 10)), | ||
), | ||
alignment: Alignment.center, | ||
padding: maxLines == 1 | ||
? null | ||
: padding ?? const EdgeInsets.symmetric(horizontal: 8, vertical: 12), | ||
child: Text( | ||
label, | ||
textAlign: TextAlign.center, | ||
maxLines: maxLines, | ||
overflow: TextOverflow.ellipsis, | ||
style: textStyle ?? Theme.of(context).textTheme.bodyMedium?.copyWith( | ||
fontSize: 16, | ||
height: 20 / 16, | ||
fontWeight: FontWeight.w500, | ||
color: Colors.white | ||
) | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
abstract class BeforeReconnectHandler { | ||
Future<void> onBeforeReconnect(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:core/utils/app_logger.dart'; | ||
|
||
typedef BeforeReconnectListener = Future<void> Function(); | ||
|
||
class BeforeReconnectManager { | ||
static final BeforeReconnectManager _instance = BeforeReconnectManager._(); | ||
factory BeforeReconnectManager() => _instance; | ||
BeforeReconnectManager._(); | ||
|
||
final _listeners = <BeforeReconnectListener>[]; | ||
|
||
void addListener(BeforeReconnectListener listener) { | ||
_listeners.add(listener); | ||
} | ||
|
||
void removeListener(BeforeReconnectListener listener) { | ||
_listeners.remove(listener); | ||
} | ||
|
||
Future<void> executeBeforeReconnectListeners() async { | ||
await Future.wait(_listeners.map((listener) => listener.call())) | ||
.onError((error, stackTrace) => [logError(error.toString())]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.