Skip to content

Instantly share code, notes, and snippets.

@vijayinyoutube
Created April 25, 2020 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijayinyoutube/d98779f024db1ee995bccc01358c269d to your computer and use it in GitHub Desktop.
Save vijayinyoutube/d98779f024db1ee995bccc01358c269d to your computer and use it in GitHub Desktop.
Dark Theme in Flutter
import 'package:flutter/material.dart';
import 'package:youtube/Page1.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark(),
debugShowCheckedModeBanner: false,
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text("Dark Theme"),
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
FlatButton(
child: Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
onPressed: () {
print("hai111");
Navigator.of(context)
.push(MaterialPageRoute(builder: (BuildContext context) {
return MyPage1();
}));
},
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
Card(
elevation: 1,
child: ListTile(
trailing: Icon(
Icons.navigate_next,
size: 40,
color: Colors.red,
),
title: Text(
"My Card",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 25,
color: Colors.red),
),
),
),
],
),
),
);
}
}
import 'package:flutter/material.dart';
class MyPage1 extends StatefulWidget {
MyPage1({Key key}) : super(key: key);
@override
My_Page1State createState() => My_Page1State();
}
class My_Page1State extends State<MyPage1> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text("Welcome", style: TextStyle(fontSize: 30)),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment