Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:flutter_map/flutter_map.dart';
- import 'package:latlong/latlong.dart';
- import 'package:cloud_firestore/cloud_firestore.dart';
- void main() {
- runApp(TabBarDemo());
- }
- class TabBarDemo extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- home: DefaultTabController(
- length: 4,
- child: Scaffold(
- appBar: AppBar(
- bottom: TabBar(
- tabs: [
- Tab(icon: Icon(Icons.calendar_today)),
- Tab(icon: Icon(Icons.directions)),
- Tab(icon: Icon(Icons.chat)),
- Tab(icon: Icon(Icons.list)),
- ],
- ),
- title: Text('WSDC 2018'),
- ),
- body: TabBarView(
- children: [
- //ExpansionTileSample(),
- Scaffold(
- body: ListView.builder(
- itemBuilder: (BuildContext context, int index) =>
- EntryItem(data[index]),
- itemCount: data.length,
- ),
- ),
- /*
- Scaffold(
- body: new ZoomableImage(
- new AssetImage('images/mreza.png'),
- placeholder: const Center(child: const CircularProgressIndicator()),
- backgroundColor: Colors.white
- ),
- ),*/
- OfflineMapPage(),
- MyHomePage(),
- Pairing(),
- ],
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- ),debugShowCheckedModeBanner: false,
- );
- }
- }
- class ExpansionTileSample extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- home: Scaffold(
- body: ListView.builder(
- itemBuilder: (BuildContext context, int index) =>
- EntryItem(data[index]),
- itemCount: data.length,
- ),
- ),
- );
- }
- }
- // One entry in the multilevel list displayed by this app.
- class Entry {
- Entry(this.title, [this.children = const <Entry>[]]);
- final String title;
- final List<Entry> children;
- }
- // The entire multilevel list displayed by this app.
- final List<Entry> data = <Entry>[
- Entry('Tuesday 17.07.',<Entry>[
- Entry('10:00 – … Registrations'),
- Entry('19:30 Dinner (Hotel)'),
- ],),
- Entry('Wednesday 18.07.',<Entry>[
- Entry('10:30 Adjudicator briefing (obligatory for all adjudicators)'),
- Entry('14:00 New nations meeting'),
- Entry('16:00 Team managers meeting'),
- Entry('17:50 Departures for Opening Ceremony'),
- Entry('19:30 Opening Ceremony and dinner (at the venue)'),
- Entry('21:30 Return to the Hotel'),
- ],),
- Entry('Thursday 19.07.',<Entry>[
- Entry('09:00 Departure from the Hotel'),
- Entry('10:00 Opening assembly'),
- Entry('10:30 Round 1'),
- Entry('12:30 Lunch break'),
- Entry('14:30 Round 2'),
- Entry('16:30 Departure for hotel'),
- Entry('20:30 First council meeting'),
- ],),
- Entry('Friday 20.07.',<Entry>[
- Entry('09:00 Departure from the Hotel'),
- Entry('10:00 Opening assembly'),
- Entry('10:30 Round 3 motion announcement'),
- Entry('11:30 Round 3'),
- Entry('13:30 Lunch break'),
- Entry('15:00 Round 4 pairing and motion announcement'),
- Entry('16:00 Round 4'),
- Entry('18:00 Departure for the hotel'),
- Entry('21:00 Country expo'),
- ],),
- Entry('Saturday 21.07',<Entry>[
- Entry('00:00 Free day'),
- ],),
- Entry('Sunday 22.07.',<Entry>[
- Entry('09:00 Departure from the Hotel'),
- Entry('10:00 Opening assembly'),
- Entry('10:30 Round 5'),
- Entry('12:30 Lunch break'),
- Entry('14:30 Round 6 pairing and motion announcement'),
- Entry('15:30 Round 6'),
- Entry('17:30 Departure for the hotel'),
- Entry('20:30 Second council meeting'),
- ],),
- Entry('Monday 23.07.',<Entry>[
- Entry('09:00 Departure from the Hotel'),
- Entry('10:00 Opening assembly'),
- Entry('10:30 Round 7'),
- Entry('12:30 Lunch break'),
- Entry('14:30 Round 8 pairing and motion announcement'),
- Entry('15:30 Round 8'),
- Entry('17:30 Departure for the hotel'),
- Entry('19:00 Dinner at the hotel'),
- Entry('21:00 Departures for Break night party'),
- Entry('22:30 Break announcements'),
- Entry('23:00 Departures for the Hotel (not obligatory - you can stay at the break night venue)'),
- ],),
- Entry('Tuesday 24.07.',<Entry>[
- Entry('09:00 Departure from the Hotel'),
- Entry('10:00 Opening assembly'),
- Entry('10:15 DO motion announcement'),
- Entry('11:15 Double octos'),
- Entry('13:00 Lunch break'),
- Entry('14:30 Octo motion announcement'),
- Entry('15:30 Octos'),
- Entry('17:30 Departure for the hotel'),
- Entry('20:30 Possible another council meeting'),
- ],),
- Entry('Wednesday 25.07.',<Entry>[
- Entry('09:30 Departure from the Hotel'),
- Entry('10:00 Opening assembly'),
- Entry('10:15 QF motion announcement'),
- Entry('11:15 QF'),
- Entry('13:00 Lunch break'),
- Entry('14:30 SF motion announcement'),
- Entry('15:30 SF'),
- Entry('17:30 Departure for the hotel'),
- ],),
- Entry('Thursday 26.07.',<Entry>[
- Entry('10:30 Third council meeting'),
- Entry('17:00 Finals'),
- Entry('19:00 Closing ceremony'),
- ],),
- ];
- // Displays one Entry. If the entry has children then it's displayed
- // with an ExpansionTile.
- class EntryItem extends StatelessWidget {
- const EntryItem(this.entry);
- final Entry entry;
- Widget _buildTiles(Entry root) {
- if (root.children.isEmpty) return ListTile(title: Text(root.title));
- return ExpansionTile(
- key: PageStorageKey<Entry>(root),
- title: Text(root.title),
- children: root.children.map(_buildTiles).toList(),
- );
- }
- @override
- Widget build(BuildContext context) {
- return _buildTiles(entry);
- }
- }
- class OfflineMapPage extends StatelessWidget {
- static const String route = '/offline_map';
- Widget build(BuildContext context) {
- return new Scaffold(
- body: new Padding(
- padding: new EdgeInsets.all(8.0),
- child: new Column(
- children: [
- new Padding(
- padding: new EdgeInsets.only(top: 8.0, bottom: 8.0),
- child: new Text("Offline map"),
- ),
- new Flexible(
- child: new FlutterMap(
- options: new MapOptions(
- center: new LatLng(45.8045, 15.9788),
- minZoom: 13.0,
- maxZoom: 16.0,
- zoom: 13.0,
- swPanBoundary: LatLng(45.767523, 15.95404),
- nePanBoundary: LatLng(45.843238, 16.039608),
- ),
- layers: [
- new TileLayerOptions(
- offlineMode: true,
- maxZoom: 14.0,
- urlTemplate: "Map/{z}/{x}/{y}.png",
- ),
- new MarkerLayerOptions(
- markers: [
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80568, 15.95208),builder: (ctx) => new Container(child: new Text("Hotel Panorama"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80568, 15.95208),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80391, 15.95441),builder: (ctx) => new Container(child: new Text("Hostel Moving"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80391, 15.95441),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81968, 16.0069),builder: (ctx) => new Container(child: new Text("Venue: MIOC"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81968, 16.0069),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80246, 15.94419),builder: (ctx) => new Container(child: new Text("Venue: Senoa"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80246, 15.94419),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81957, 16.00555),builder: (ctx) => new Container(child: new Text("Venue: Nazor"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81957, 16.00555),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80938, 15.97011),builder: (ctx) => new Container(child: new Text("Opening"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80938, 15.97011),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81179, 15.97333),builder: (ctx) => new Container(child: new Text("Finals"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81179, 15.97333),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81453, 15.97371),builder: (ctx) => new Container(child: new Text("Octos"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81453, 15.97371),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81058, 15.96973),builder: (ctx) => new Container(child: new Text("Quarters/Semis"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.81058, 15.96973),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80842, 15.96865),builder: (ctx) => new Container(child: new Text("Quarters/Semis"),),),
- new Marker(width: 80.0,height: 80.0,point: new LatLng(45.80842, 15.96865),builder: (ctx) => new Container(child: new IconButton(icon: Icon(Icons.location_on),color: Colors.red,iconSize: 20.0,onPressed: (){} ,),),),
- ],
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
- class OnlineApp extends StatelessWidget {
- const OnlineApp();
- @override
- Widget build(BuildContext context) {
- return new MaterialApp(
- title: 'WSDC Notifications',
- home: const MyHomePage(title: 'WSDC Notifs'),
- );
- }
- }
- class MyHomePage extends StatelessWidget {
- const MyHomePage({Key key, this.title}) : super(key: key);
- final String title;
- @override
- Widget build(BuildContext context) {
- return new Scaffold(
- body: new StreamBuilder(
- stream: Firestore.instance.collection('wsdc_announcements').orderBy('time', descending: true).snapshots(),
- builder: (context, snapshot) {
- if (!snapshot.hasData) return const Text('Loading...');
- return new ListView.builder(
- itemCount: snapshot.data.documents.length,
- padding: const EdgeInsets.only(top: 10.0, left: 5.0, right: 5.0),
- itemBuilder: (context, index) {
- DocumentSnapshot ds = snapshot.data.documents[index];
- var text = new RichText(
- text: new TextSpan(
- // Note: Styles for TextSpans must be explicitly defined.
- // Child text spans will inherit styles from parent
- style: new TextStyle(
- fontSize: 14.0,
- color: Colors.black,
- ),
- children: <TextSpan>[
- new TextSpan(text: "${ds['title']} \n", style: new TextStyle(fontWeight: FontWeight.bold)),
- new TextSpan(text: "${ds['time']} \n", style: new TextStyle(fontStyle: FontStyle.italic)),
- new TextSpan(text: "${ds['announcement']}\n\n"),
- ],
- ),
- textAlign: TextAlign.justify,
- );
- //return new Text("${ds['title']} ${ds['time']} \n ${ds['announcement']} \n");
- return text;
- }
- );
- }),
- );
- }
- }
- class Pairing extends StatelessWidget {
- const Pairing({Key key, this.title}) : super(key: key);
- final String title;
- @override
- Widget build(BuildContext context) {
- return new Scaffold(
- body: new StreamBuilder(
- stream: Firestore.instance.collection('wsdc_pairing').orderBy('round_no', descending: true).snapshots(),
- builder: (context, snapshot) {
- if (!snapshot.hasData) return const Text('Loading...');
- return new ListView.builder(
- itemCount: snapshot.data.documents.length,
- padding: const EdgeInsets.only(top: 10.0, left: 5.0, right: 5.0),
- itemBuilder: (context, index) {
- DocumentSnapshot ds = snapshot.data.documents[index];
- var text = new RichText(
- text: new TextSpan(
- // Note: Styles for TextSpans must be explicitly defined.
- // Child text spans will inherit styles from parent
- style: new TextStyle(
- fontSize: 14.0,
- color: Colors.black,
- ),
- children: <TextSpan>[
- new TextSpan(text: "Pairing for round ${ds['round_no']} \n", style: new TextStyle(fontWeight: FontWeight.bold)),
- new TextSpan(text: "${ds['pairing']}\n\n".replaceAll('_n_', '\n')),
- ],
- ),
- textAlign: TextAlign.justify,
- );
- //return new Text("${ds['title']} ${ds['time']} \n ${ds['announcement']} \n");
- return text;
- }
- );
- }),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement