-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.dart
178 lines (163 loc) · 7.71 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import 'package:flutter/material.dart';
import 'package:hello/Session.dart';
import 'open-cx-master/open-cx-master/open_cx/lib/Screens/Schedule/Calendar.dart';
// Acho que agora funcionou mais ou menos mas está a aparecer uma barra amarela e preta de perigo no android
// Vou tentar comentar os widgets anteriores para ver se dá
// O perigo faz parte da nossa profissão xD
// Só uma cena, esse calendário é o do ano passado? É tipo o já existente do projeto?
// Yas, só que não podemos usar o calendário do ano passado diretamente porque eles usavam uma classe Talk que tinha coisas que eu não percebia o que era
// Okz, então queremos criar o nosso próprio calendário um bocado diferente do outro para pormos as nossas sessoes?
// Yas, mas acho que agora está a funcionar mais ou menos, só que aparece aquela barra amarela estranha e não está a aparecer a sessão que pus no construtor
// Vou te mandar print para o messenger. Yas
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: CreateSession(title: 'Flutter Demo Home Page'),
);
}
}
class CreateSession extends StatefulWidget {
CreateSession({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_CreateSessionState createState() => _CreateSessionState();
}
class _CreateSessionState extends State<CreateSession> {
DateTime _dateTime;
TimeOfDay _initialTimeOfDay, _finalTimeOfDay;
String _selectedPlatform;
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
/*TextField(
decoration: InputDecoration(
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.teal)
),
hintText: 'Name of the Session'
),
),
//Text(_dateTime == null ? 'Nothing has been picked yet' : _dateTime.toString()), Não ligues a isto
RaisedButton(
child: Text(_dateTime == null ? 'Date: ' : 'Date: ' + _dateTime.day.toString() + '/' + _dateTime.month.toString() + '/' + _dateTime.year.toString()),
onPressed: () {
showDatePicker(
context: context,
initialDate: _dateTime == null ? DateTime.now() : _dateTime,
firstDate: DateTime(2001),
lastDate: DateTime(2021)
).then((date) {
setState(() {
_dateTime = date;
});
});
},
),
RaisedButton(
child: Text(_initialTimeOfDay == null ? 'Initial Time: ' : 'Initial time: ' + _initialTimeOfDay.hour.toString() + ":" + _initialTimeOfDay.minute.toString()),
onPressed: () {
showTimePicker(
context: context,
initialTime: _initialTimeOfDay == null ? TimeOfDay.now() : _initialTimeOfDay,
).then((time) {
setState(() {
_initialTimeOfDay = time;
});
});
},
),
RaisedButton(
child: Text(_finalTimeOfDay == null ? 'Final Time: ' : 'Final time: ' + _finalTimeOfDay.hour.toString() + ":" + _finalTimeOfDay.minute.toString()),
onPressed: () {
showTimePicker(
context: context,
initialTime: _finalTimeOfDay == null ? TimeOfDay.now() : _finalTimeOfDay,
).then((time) {
setState(() {
_finalTimeOfDay = time;
});
});
},
),
DropdownButton<String>(
hint: Text('Platform'),
value: _selectedPlatform,
onChanged: (platform) {
setState(() {
_selectedPlatform = platform;
});
},
items: <String>['Zoom', 'Teams', 'Other'].map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
),*/
Calendar([new Session(1, "ola", new DateTime(2020, 12, 8), new TimeOfDay(hour: 16, minute: 0), new TimeOfDay(hour: 17, minute: 30), _selectedPlatform, "https://github.com/FEUP-ESOF-2020-21/open-cx-t1g5-esoflers")])
],
),
),
);
}
}