Skip to content

Instantly share code, notes, and snippets.

@klashxx
Created April 7, 2019 14:53
Show Gist options
  • Save klashxx/df68e5fd1b972a2c4344c14f3298c015 to your computer and use it in GitHub Desktop.
Save klashxx/df68e5fd1b972a2c4344c14f3298c015 to your computer and use it in GitHub Desktop.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:io' show Platform;
import 'package:flutter/cupertino.dart';
import './events.dart';
import './members.dart';
import './galery.dart';
void main() {
runApp(LunaRojaApp());
}
class LunaRojaApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final appName = 'Luna Roja Teatro';
return MaterialApp(
title: appName,
theme: ThemeData(
// Define the default Brightness and Colors
brightness: Brightness.dark,
primaryColor: Color.fromARGB(0xFF, 0x61, 0x0B, 0x0B),
accentColor: Colors.red[300],
bottomAppBarColor: Color.fromARGB(0xFF, 0x61, 0x0B, 0x0B),
// Define the default Font Family
fontFamily: 'Alegreya',
// Define the default TextTheme. Use this to specify the default
// text styling for headlines, titles, bodies of text, and more.
textTheme: TextTheme(
headline: TextStyle(fontSize: 72.0, fontWeight: FontWeight.bold),
title: TextStyle(fontSize: 36.0, fontStyle: FontStyle.italic),
body1: TextStyle(fontSize: 14.0, fontFamily: 'Hind'),
),
),
home: HomePage(
title: appName,
),
);
}
}
class HomePage extends StatefulWidget {
final String title;
final String selectedOption = 'EVENTS';
HomePage({Key key, @required this.title}) : super(key: key);
@override
_HomepageState createState() => _HomepageState();
}
class _HomepageState extends State<HomePage> {
String _selectedOption;
@override
void initState() {
_selectedOption = widget.selectedOption;
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).primaryColor,
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: const Text('EN CARTEL'),
onPressed: () {
setState(() {
_selectedOption = 'EVENTS';
});
}),
FlatButton(
child: const Text('LA COMPAÑIA'),
onPressed: () {
setState(() {
_selectedOption = 'MEMBERS';
});
},
),
FlatButton(
child: const Text('GALERIA'),
onPressed: () {
setState(() {
_selectedOption = 'GALERIA';
});
},
),
],
),
titleSpacing: 24.0,
snap: false,
expandedHeight: 120.0,
floating: true,
pinned: false,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
titlePadding: EdgeInsets.all(0.0),
title: Padding(
padding: EdgeInsets.only(top: 100.0, bottom: 1.0),
child: Text("Luna Roja Teatro",
style: TextStyle(
color: Colors.white,
fontSize: 22.0,
))),
background: Image.asset(
"assets/title.png",
fit: BoxFit.cover,
)),
),
];
},
body: _selectedOption == 'EVENTS'
? EventManager()
: _selectedOption == 'MEMBERS' ? MemberManager() : GaleryManager(),
),
bottomNavigationBar: BottomAppBar(
child: Container(
height: 30.0,
padding: EdgeInsets.all(0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Row(children: <Widget>[
Platform.isIOS
? Icon(CupertinoIcons.search)
: Icon(Icons.search),
]),
onPressed: () {},
),
FlatButton(
child: Row(children: <Widget>[
Platform.isIOS ? Icon(CupertinoIcons.home) : Icon(Icons.home),
]),
onPressed: () {
setState(() {
_selectedOption = 'EVENTS';
});
},
),
FlatButton(
child: Row(children: <Widget>[
Platform.isIOS ? Icon(CupertinoIcons.add) : Icon(Icons.add),
]),
onPressed: () {},
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment