Skip to content

Instantly share code, notes, and snippets.

@RipplesCode
Created January 5, 2021 11:46
Show Gist options
  • Save RipplesCode/cf807927ef39cbb0d6bc85c40592a203 to your computer and use it in GitHub Desktop.
Save RipplesCode/cf807927ef39cbb0d6bc85c40592a203 to your computer and use it in GitHub Desktop.
GetX Dialog
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return GetMaterialApp(
title: "Dialog",
home: Scaffold(
appBar: AppBar(title: Text("Dialog")),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
RaisedButton(
child: Text("Show Dialog"),
onPressed: () {
//Get.defaultDialog();
Get.defaultDialog(
title: "Dialog Title",
titleStyle: TextStyle(fontSize: 25),
middleText: "This is middle text",
middleTextStyle: TextStyle(fontSize: 20),
backgroundColor: Colors.purple,
//radius: 80,
// To customize the middle text
// content: Row(
// children: [
// CircularProgressIndicator(),
// SizedBox(
// width: 16,
// ),
// Expanded(
// child: Text("Data Loading"),
// ),
// ],
// ),
// Default cancel and confirm action
// textCancel: "Cancel",
// cancelTextColor: Colors.white,
// textConfirm: "Confirm",
// confirmTextColor: Colors.white,
// onCancel: () {},
// onConfirm: () {},
// color for default cancel and confirm button
// buttonColor: Colors.green,
//Customize the default cancel and confirm
//Override the default cancel and confirm
// cancel: Text(
// "Cancels",
// style: TextStyle(color: Colors.white),
// ),
// confirm: Text(
// "Confirms",
// style: TextStyle(color: Colors.white),
// ),
// actions: [
// RaisedButton(
// child: Text("Action-1"),
// onPressed: () {
// Get.back();
// },
// ),
// RaisedButton(
// child: Text("Action-2"),
// onPressed: () {},
// )
// ],
// barrierDismissible: true,
);
},
),
],
)),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment