I have a problem on displaying the pop-up card when clicking the specific Persistent Bottom Nav Bar button. I want to display it over the homepage. I have been trying my best to think of possible ways to implement this code. Can anyone help me?
Expected Output: Current Output:
Here is my code for this Addmodal.dart file:
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:proj3/homepage/homepage.dart';
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
void _showAddModal(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return MyAddmodal();
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: const BackButton(
color: Colors.black,
),
centerTitle: false,
title: Text(title, style: TextStyle(color: Colors.black)),
actions: <Widget>[],
backgroundColor: Color.fromARGB(255, 255, 255, 255),
),
body: const Center(
child: Text('Na boang nako niya!'),
),
);
}
}
class MyAddmodal extends StatelessWidget {
const MyAddmodal({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: Container(
height: 200.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
icon: Icon(Icons.close),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const Myhomepage(),
));
},
),
],
),
Text(
'What do you want to do?',
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold,
fontSize: 18.0,
),
),
const SizedBox(height: 10.0),
ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
primary: Color(0xff6C63FF),
padding: EdgeInsets.symmetric(horizontal: 39, vertical: 5),
),
onPressed: () {
// Handle first menu option
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const MyHomePage(title: 'Create Lend Listing'),
));
},
child: Text(
'Create Lend Listing',
style: GoogleFonts.poppins(
fontSize: 16.5,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
primary: Color(0xff6C63FF),
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
),
onPressed: () {
// Handle second menu option
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const MyHomePage(title: 'Create Borrow Request'),
));
},
child: Text(
'Create Borrow Request',
style: GoogleFonts.poppins(
fontSize: 16.5,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
}