Skip to content

Instantly share code, notes, and snippets.

@timbergus
Created June 11, 2019 21:16
Show Gist options
  • Save timbergus/5f609eb046611eae7b68bf3a71a300f3 to your computer and use it in GitHub Desktop.
Save timbergus/5f609eb046611eae7b68bf3a71a300f3 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.yellow,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool logged = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Codex'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Text('Login'),
onPressed: () {},
color: Colors.blue[300],
),
RaisedButton(
child: Text('Logout'),
onPressed: () {},
color: Colors.red[300],
),
SizedBox(
height: 20,
),
logged
? Text(
'The user is logged!',
style: TextStyle(
color: Colors.blue,
),
)
: Text(
'The user is not logged!',
style: TextStyle(
color: Colors.red,
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment