Dialog Box using GetX

 import "package:flutter/material.dart";

import "package:get/get.dart";

void main() {
runApp(const MyApp(),);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: "GetX Dialog Box",
theme: ThemeData(
primarySwatch: Colors.grey,
),
home: const DemoDialog(),
);
}
}
class DemoDialog extends StatelessWidget {
const DemoDialog({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("GetX Dialog Box", style: TextStyle(color: Colors.white, fontFamily: "FontsSeven", fontSize: 50.0,),),
centerTitle: true,
toolbarHeight: 300.0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.elliptical(500.0, 100.0,),
),
),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Get.defaultDialog(
title: "GetX Dialog Box",
middleText: "This is the best Dialog Box in flutter using GetX",
content: Column(
children: [
const Text("GetX Dialog Box"),
const Text("This is the best Dialog Box in flutter using GetX"),
TextFormField(),
],
),
titlePadding: const EdgeInsets.all(10.0,),
contentPadding: const EdgeInsets.all(10.0,),
radius: 10.0,
actions: [
OutlinedButton(
onPressed: () { Get.back(); },
child: const Text("Cancel", style: TextStyle(color: Colors.black,),),
),
ElevatedButton(
onPressed: () { Get.back(); },
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
),
child: const Text("Done"),
),
],
);
},
child: const Text("GetX Dialog Box"),
),
],
),
),
);
}
}

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter