main.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. import 'package:firebase_core/firebase_core.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:latlong2/latlong.dart';
  4. import 'package:physigo/exercises/exercises_page.dart';
  5. import 'package:physigo/friends/friends_page.dart';
  6. import 'navigation/navigation_page.dart';
  7. import 'firebase_options.dart';
  8. import 'push_notifications_initializer.dart';
  9. void main() async {
  10. WidgetsFlutterBinding.ensureInitialized();
  11. await Firebase.initializeApp(
  12. options: DefaultFirebaseOptions.currentPlatform,
  13. );
  14. handleMessages();
  15. runApp(const PhysiGo());
  16. }
  17. class PhysiGo extends StatelessWidget {
  18. const PhysiGo({Key? key}) : super(key: key);
  19. @override
  20. Widget build(BuildContext context) {
  21. return MaterialApp(
  22. title: 'PhsyGo',
  23. theme: ThemeData(
  24. primarySwatch: Colors.blueGrey,
  25. ),
  26. initialRoute: '/',
  27. routes: {
  28. '/': (context) => MyHomePage(
  29. title: '',
  30. ),
  31. '/register': (context) => RegisterScreen(
  32. title: '',
  33. ),
  34. '/register2': (context) => RegisterScreen2(title: ''),
  35. '/register3': (context) => RegisterScreen3(title: ''),
  36. '/login': (context) => LogIn(title: '')
  37. },
  38. //home: const MyHomePage(title: 'Flutter Demo Home Page'),
  39. );
  40. }
  41. }
  42. class MyHomePage extends StatefulWidget {
  43. const MyHomePage({Key? key, required this.title}) : super(key: key);
  44. final String title;
  45. @override
  46. State<MyHomePage> createState() => _MyHomePageState();
  47. }
  48. class _MyHomePageState extends State<MyHomePage> {
  49. @override
  50. Widget build(BuildContext context) {
  51. return SafeArea(
  52. child: Scaffold(
  53. body: Column(
  54. mainAxisAlignment: MainAxisAlignment.center,
  55. children: [
  56. Center(
  57. child: TextButton(
  58. onPressed: () {
  59. Navigator.push(
  60. context,
  61. MaterialPageRoute(
  62. // Example on how to use NavigationPage
  63. builder: (context) => NavigationPage(
  64. destination: LatLng(51.78036111980833, 19.451262207821234),
  65. ),
  66. ),
  67. );
  68. },
  69. child: const Text('Navigation')),
  70. ),
  71. Center(
  72. child: TextButton(
  73. onPressed: () {
  74. Navigator.push(
  75. context,
  76. MaterialPageRoute(
  77. builder: (context) => const ExercisesPage(),
  78. ),
  79. );
  80. },
  81. child: const Text('Exercises'),
  82. ),
  83. ),
  84. Center(
  85. child: TextButton(
  86. onPressed: () {
  87. Navigator.push(
  88. context,
  89. MaterialPageRoute(
  90. builder: (context) => const FriendsPage(),
  91. ),
  92. );
  93. },
  94. child: const Text('Friends'),
  95. ),
  96. ),
  97. const SizedBox(height: 30),
  98. Image.asset(
  99. 'assets/teamlogo.png',
  100. width: 260,
  101. ),
  102. const SizedBox(height: 30),
  103. ElevatedButton(
  104. // Within the `FirstScreen` widget
  105. onPressed: () {
  106. // Navigate to the second screen using a named route.
  107. Navigator.pushNamed(context, '/register');
  108. },
  109. child: Text('Register'),
  110. ),
  111. ElevatedButton(
  112. onPressed: () {
  113. Navigator.pushNamed(context, '/login');
  114. },
  115. child: const Text('Log In'),
  116. )
  117. ],
  118. ),
  119. ),
  120. );
  121. }
  122. }
  123. class RegisterScreen extends StatefulWidget {
  124. const RegisterScreen({Key? key, required this.title}) : super(key: key);
  125. final String title;
  126. @override
  127. //_RegisterScreen createState() => _RegisterScreen();
  128. State<RegisterScreen> createState() => _RegisterScreen();
  129. }
  130. class _RegisterScreen extends State<RegisterScreen> {
  131. DateTime? _dateTime;
  132. String? _dateString;
  133. @override
  134. Widget build(BuildContext context) {
  135. return Scaffold(
  136. appBar: AppBar(
  137. title: const Text('Register Screen'),
  138. ),
  139. body: Center(
  140. child: SizedBox(
  141. width: 300,
  142. child: Column(children: <Widget>[
  143. const SizedBox(height: 30),
  144. Text(
  145. 'Personal Information',
  146. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  147. ),
  148. const SizedBox(height: 30),
  149. Image.asset(
  150. 'assets/user.png',
  151. width: 150,
  152. ),
  153. const SizedBox(height: 30),
  154. TextField(
  155. decoration: InputDecoration(
  156. hintText: 'Name',
  157. ),
  158. ),
  159. const SizedBox(height: 10),
  160. TextField(
  161. decoration: InputDecoration(
  162. hintText: 'Surname',
  163. ),
  164. ),
  165. const SizedBox(height: 10),
  166. Row(children: <Widget>[
  167. Text(_dateString == null ? 'Select birthday date :' : _dateString.toString()),
  168. const SizedBox(width: 49),
  169. ElevatedButton(
  170. onPressed: () {
  171. showDatePicker(
  172. context: context,
  173. initialDate: DateTime.now(),
  174. firstDate: DateTime(1900),
  175. lastDate: DateTime(2222))
  176. .then((date) {
  177. setState(() {
  178. _dateTime = date!;
  179. _dateString = "${date.day}/${date.month}/${date.year}";
  180. });
  181. });
  182. },
  183. child: const Text('Select date'),
  184. ),
  185. ]),
  186. const SizedBox(height: 10),
  187. ElevatedButton(
  188. onPressed: () {
  189. Navigator.pushNamed(context, '/register2');
  190. },
  191. child: const Text('Next Page'),
  192. ),
  193. ]),
  194. )),
  195. );
  196. }
  197. }
  198. class RegisterScreen2 extends StatefulWidget {
  199. const RegisterScreen2({Key? key, required this.title}) : super(key: key);
  200. final String title;
  201. @override
  202. //_RegisterScreen createState() => _RegisterScreen();
  203. State<RegisterScreen2> createState() => _RegisterScreen2();
  204. }
  205. class _RegisterScreen2 extends State<RegisterScreen2> {
  206. bool isChecked = false;
  207. @override
  208. Widget build(BuildContext context) {
  209. return Scaffold(
  210. appBar: AppBar(
  211. title: const Text('Register Screen'),
  212. ),
  213. body: Center(
  214. child: SizedBox(
  215. width: 300,
  216. child: Column(children: <Widget>[
  217. const SizedBox(height: 30),
  218. Text(
  219. 'Contact Details',
  220. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  221. ),
  222. const SizedBox(height: 30),
  223. Image.asset(
  224. 'assets/communicate.png',
  225. width: 150,
  226. ),
  227. const SizedBox(height: 30),
  228. TextField(
  229. decoration: InputDecoration(
  230. hintText: 'Mail',
  231. ),
  232. ),
  233. const SizedBox(height: 10),
  234. TextField(
  235. decoration: InputDecoration(
  236. hintText: 'Phone Number',
  237. ),
  238. ),
  239. const SizedBox(height: 10),
  240. TextField(
  241. decoration: InputDecoration(
  242. hintText: 'Home Adress..',
  243. ),
  244. ),
  245. const SizedBox(height: 10),
  246. Row(children: <Widget>[
  247. Text('Anonymous'),
  248. Checkbox(
  249. checkColor: Colors.white,
  250. value: isChecked,
  251. onChanged: (bool? value) {
  252. setState(() {
  253. isChecked = value!;
  254. });
  255. },
  256. ),
  257. ]),
  258. const SizedBox(height: 10),
  259. ElevatedButton(
  260. onPressed: () {
  261. Navigator.pushNamed(context, '/register3');
  262. },
  263. child: const Text('Next Page'),
  264. ),
  265. ]),
  266. )),
  267. );
  268. }
  269. }
  270. class RegisterScreen3 extends StatefulWidget {
  271. const RegisterScreen3({Key? key, required this.title}) : super(key: key);
  272. final String title;
  273. @override
  274. //_RegisterScreen createState() => _RegisterScreen();
  275. State<RegisterScreen3> createState() => _RegisterScreen3();
  276. }
  277. class _RegisterScreen3 extends State<RegisterScreen3> {
  278. @override
  279. Widget build(BuildContext context) {
  280. return Scaffold(
  281. appBar: AppBar(
  282. title: const Text('Register Screen'),
  283. ),
  284. body: Center(
  285. child: SizedBox(
  286. width: 300,
  287. child: Column(children: <Widget>[
  288. const SizedBox(height: 30),
  289. Text(
  290. 'User details',
  291. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  292. ),
  293. const SizedBox(height: 30),
  294. Image.asset(
  295. 'assets/id-card.png',
  296. width: 150,
  297. ),
  298. const SizedBox(height: 30),
  299. TextField(
  300. decoration: InputDecoration(
  301. hintText: 'Username',
  302. ),
  303. ),
  304. const SizedBox(height: 10),
  305. TextField(
  306. decoration: InputDecoration(
  307. hintText: 'Password',
  308. ),
  309. ),
  310. const SizedBox(height: 10),
  311. TextField(
  312. decoration: InputDecoration(
  313. hintText: 'Repeat password',
  314. ),
  315. ),
  316. const SizedBox(height: 10),
  317. const SizedBox(height: 10),
  318. ElevatedButton(
  319. onPressed: () {},
  320. child: const Text('Finish'),
  321. ),
  322. ]),
  323. )),
  324. );
  325. }
  326. }
  327. class LogIn extends StatefulWidget {
  328. const LogIn({Key? key, required this.title}) : super(key: key);
  329. final String title;
  330. @override
  331. //_RegisterScreen createState() => _RegisterScreen();
  332. State<LogIn> createState() => _LogIn();
  333. }
  334. class _LogIn extends State<LogIn> {
  335. @override
  336. Widget build(BuildContext context) {
  337. return Scaffold(
  338. appBar: AppBar(
  339. title: const Text('Login Screen'),
  340. ),
  341. body: Center(
  342. child: SizedBox(
  343. width: 300,
  344. child: Column(children: <Widget>[
  345. const SizedBox(height: 30),
  346. Text(
  347. 'Welcome back!',
  348. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  349. ),
  350. const SizedBox(height: 30),
  351. Image.asset(
  352. 'assets/hello.png',
  353. width: 150,
  354. ),
  355. const SizedBox(height: 30),
  356. TextField(
  357. decoration: InputDecoration(
  358. hintText: 'Mail or mobile phone',
  359. ),
  360. ),
  361. const SizedBox(height: 10),
  362. TextField(
  363. decoration: InputDecoration(
  364. hintText: 'Password',
  365. ),
  366. ),
  367. const SizedBox(height: 10),
  368. ElevatedButton(
  369. onPressed: () {},
  370. child: const Text('Log In'),
  371. ),
  372. ]),
  373. )),
  374. );
  375. }
  376. }