Skip to content

Instantly share code, notes, and snippets.

@vipulshah2010
Created August 10, 2023 12:51
Show Gist options
  • Save vipulshah2010/beb976959721996d78bf720338dfc8ef to your computer and use it in GitHub Desktop.
Save vipulshah2010/beb976959721996d78bf720338dfc8ef to your computer and use it in GitHub Desktop.
solar-rainbow-0772
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter App',
theme: ThemeData(
colorSchemeSeed: Colors.indigo,
useMaterial3: true,
brightness: Brightness.light,
),
darkTheme: ThemeData(
colorSchemeSeed: Colors.blue,
useMaterial3: true,
brightness: Brightness.dark,
),
home: const MyHomePage(),
debugShowCheckedModeBanner: false,
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
showModalBottomSheet(
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.vertical(top: Radius.circular(25.0))),
context: context,
isScrollControlled: true,
builder: (context) => Padding(
padding: EdgeInsets.only(
top: 20,
right: 20,
left: 20,
bottom: MediaQuery.of(context).viewInsets.bottom),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Center(
child: Text(
'Name',
),
),
SizedBox(height: 8.0),
TextField(
decoration:
InputDecoration(hintText: 'Counterparty name'),
autofocus: true,
),
SizedBox(height: 10),
TextField(
decoration:
InputDecoration(hintText: 'Counterparty account'),
autofocus: true,
),
SizedBox(height: 10),
ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text('Submit'),
),
],
),
));
},
child: const Text('Show Modal Bottom Sheet'),
),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment