35 lines
1.3 KiB
Dart
35 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rkm/screens/home_screen.dart';
|
|
import 'package:rkm/widgets/text_default.dart';
|
|
import '../config/color_palette.dart';
|
|
import 'button_default.dart';
|
|
|
|
class OnBackButton{
|
|
onBackButton(context,String username)async {
|
|
await showDialog(
|
|
context: context,
|
|
builder: (context){
|
|
return AlertDialog(
|
|
title: TextDefault(text: 'Aviso',color: ColorPalette.black54,textAlign: TextAlign.center,),
|
|
content: TextDefault(text: 'Deseja sair e descartar as alterações?',color: ColorPalette.black54,),
|
|
actions: [
|
|
ButtonDefault(
|
|
onPressed: ()=>Navigator.pushAndRemoveUntil(context,MaterialPageRoute(builder:(context)=> HomeScreen(username: username,)), (route) => false),
|
|
title: 'Sim',
|
|
background: ColorPalette.appBar,
|
|
borderColor: ColorPalette.appBar,
|
|
textColor: ColorPalette.white,
|
|
),
|
|
ButtonDefault(
|
|
onPressed: ()=>Navigator.of(context).pop(false),
|
|
title: 'Não',
|
|
background: ColorPalette.white,
|
|
borderColor: ColorPalette.white,
|
|
textColor: ColorPalette.black54,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
);
|
|
}
|
|
} |