Skip to content

Instantly share code, notes, and snippets.

@RipplesCode
Created January 5, 2021 11:47
Show Gist options
  • Save RipplesCode/acfa4cc0f1c4d3a36369fbbd875e7d3c to your computer and use it in GitHub Desktop.
Save RipplesCode/acfa4cc0f1c4d3a36369fbbd875e7d3c to your computer and use it in GitHub Desktop.
Bottomsheet and Change Theme
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("Bottom Sheet")),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
RaisedButton(
child: Text("Bottom Sheet"),
onPressed: () {
Get.bottomSheet(
Container(
child: Wrap(
children: <Widget>[
ListTile(
leading: Icon(Icons.wb_sunny_outlined),
title: Text('Light Theme'),
onTap: () => {Get.changeTheme(ThemeData.light())}),
ListTile(
leading: Icon(Icons.wb_sunny),
title: Text('Dark Theme'),
onTap: () => {Get.changeTheme(ThemeData.dark())},
),
],
),
),
backgroundColor: Colors.purpleAccent,
isDismissible: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
side: BorderSide(
color: Colors.white,
style: BorderStyle.solid,
width: 2.0),
),
barrierColor: Colors.greenAccent.shade100,
elevation: 10,
enableDrag: true,
);
},
),
],
)),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment