import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: First(),
debugShowCheckedModeBanner: false,
);
}
}
class First extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("First Screen"),
backgroundColor: Colors.black87,
foregroundColor: Colors.white,
),
body: Center(
child: Container(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black87,
foregroundColor: Colors.white,
),
child: Text("Go to next screen"),
onPressed: () {
// Navigate to Second screen
Get.to(Second());
},
),
),
),
);
}
}
class Second extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Second Screen"),
backgroundColor: Colors.green,
foregroundColor: Colors.white,
),
body: Center(
child: Container(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
foregroundColor: Colors.white,
),
child: Text("Go to first screen"),
onPressed: () {
// Navigate to First screen
Get.back();
},
),
),
),
);
}
}