| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- import 'package:firebase_core/firebase_core.dart';
- import 'package:flutter/material.dart';
- import 'package:latlong2/latlong.dart';
- import 'package:physigo/exercises/exercises_page.dart';
- import 'package:physigo/friends/friends_page.dart';
- import 'navigation/navigation_page.dart';
- import 'firebase_options.dart';
- import 'push_notifications_initializer.dart';
- void main() async {
- WidgetsFlutterBinding.ensureInitialized();
- await Firebase.initializeApp(
- options: DefaultFirebaseOptions.currentPlatform,
- );
- handleMessages();
- runApp(const PhysiGo());
- }
- class PhysiGo extends StatelessWidget {
- const PhysiGo({Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'PhsyGo',
- theme: ThemeData(
- primarySwatch: Colors.blueGrey,
- ),
- initialRoute: '/',
- routes: {
- '/': (context) => MyHomePage(
- title: '',
- ),
- '/register': (context) => RegisterScreen(
- title: '',
- ),
- '/register2': (context) => RegisterScreen2(title: ''),
- '/register3': (context) => RegisterScreen3(title: ''),
- '/login': (context) => LogIn(title: '')
- },
- //home: const MyHomePage(title: 'Flutter Demo Home Page'),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- const MyHomePage({Key? key, required this.title}) : super(key: key);
- final String title;
- @override
- State<MyHomePage> createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- @override
- Widget build(BuildContext context) {
- return SafeArea(
- child: Scaffold(
- body: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Center(
- child: TextButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- // Example on how to use NavigationPage
- builder: (context) => NavigationPage(
- destination: LatLng(51.78036111980833, 19.451262207821234),
- ),
- ),
- );
- },
- child: const Text('Navigation')),
- ),
- Center(
- child: TextButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => const ExercisesPage(),
- ),
- );
- },
- child: const Text('Exercises'),
- ),
- ),
- Center(
- child: TextButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => const FriendsPage(),
- ),
- );
- },
- child: const Text('Friends'),
- ),
- ),
- const SizedBox(height: 30),
- Image.asset(
- 'assets/teamlogo.png',
- width: 260,
- ),
- const SizedBox(height: 30),
- ElevatedButton(
- // Within the `FirstScreen` widget
- onPressed: () {
- // Navigate to the second screen using a named route.
- Navigator.pushNamed(context, '/register');
- },
- child: Text('Register'),
- ),
- ElevatedButton(
- onPressed: () {
- Navigator.pushNamed(context, '/login');
- },
- child: const Text('Log In'),
- )
- ],
- ),
- ),
- );
- }
- }
- class RegisterScreen extends StatefulWidget {
- const RegisterScreen({Key? key, required this.title}) : super(key: key);
- final String title;
- @override
- //_RegisterScreen createState() => _RegisterScreen();
- State<RegisterScreen> createState() => _RegisterScreen();
- }
- class _RegisterScreen extends State<RegisterScreen> {
- DateTime? _dateTime;
- String? _dateString;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text('Register Screen'),
- ),
- body: Center(
- child: SizedBox(
- width: 300,
- child: Column(children: <Widget>[
- const SizedBox(height: 30),
- Text(
- 'Personal Information',
- style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
- ),
- const SizedBox(height: 30),
- Image.asset(
- 'assets/user.png',
- width: 150,
- ),
- const SizedBox(height: 30),
- TextField(
- decoration: InputDecoration(
- hintText: 'Name',
- ),
- ),
- const SizedBox(height: 10),
- TextField(
- decoration: InputDecoration(
- hintText: 'Surname',
- ),
- ),
- const SizedBox(height: 10),
- Row(children: <Widget>[
- Text(_dateString == null ? 'Select birthday date :' : _dateString.toString()),
- const SizedBox(width: 49),
- ElevatedButton(
- onPressed: () {
- showDatePicker(
- context: context,
- initialDate: DateTime.now(),
- firstDate: DateTime(1900),
- lastDate: DateTime(2222))
- .then((date) {
- setState(() {
- _dateTime = date!;
- _dateString = "${date.day}/${date.month}/${date.year}";
- });
- });
- },
- child: const Text('Select date'),
- ),
- ]),
- const SizedBox(height: 10),
- ElevatedButton(
- onPressed: () {
- Navigator.pushNamed(context, '/register2');
- },
- child: const Text('Next Page'),
- ),
- ]),
- )),
- );
- }
- }
- class RegisterScreen2 extends StatefulWidget {
- const RegisterScreen2({Key? key, required this.title}) : super(key: key);
- final String title;
- @override
- //_RegisterScreen createState() => _RegisterScreen();
- State<RegisterScreen2> createState() => _RegisterScreen2();
- }
- class _RegisterScreen2 extends State<RegisterScreen2> {
- bool isChecked = false;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text('Register Screen'),
- ),
- body: Center(
- child: SizedBox(
- width: 300,
- child: Column(children: <Widget>[
- const SizedBox(height: 30),
- Text(
- 'Contact Details',
- style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
- ),
- const SizedBox(height: 30),
- Image.asset(
- 'assets/communicate.png',
- width: 150,
- ),
- const SizedBox(height: 30),
- TextField(
- decoration: InputDecoration(
- hintText: 'Mail',
- ),
- ),
- const SizedBox(height: 10),
- TextField(
- decoration: InputDecoration(
- hintText: 'Phone Number',
- ),
- ),
- const SizedBox(height: 10),
- TextField(
- decoration: InputDecoration(
- hintText: 'Home Adress..',
- ),
- ),
- const SizedBox(height: 10),
- Row(children: <Widget>[
- Text('Anonymous'),
- Checkbox(
- checkColor: Colors.white,
- value: isChecked,
- onChanged: (bool? value) {
- setState(() {
- isChecked = value!;
- });
- },
- ),
- ]),
- const SizedBox(height: 10),
- ElevatedButton(
- onPressed: () {
- Navigator.pushNamed(context, '/register3');
- },
- child: const Text('Next Page'),
- ),
- ]),
- )),
- );
- }
- }
- class RegisterScreen3 extends StatefulWidget {
- const RegisterScreen3({Key? key, required this.title}) : super(key: key);
- final String title;
- @override
- //_RegisterScreen createState() => _RegisterScreen();
- State<RegisterScreen3> createState() => _RegisterScreen3();
- }
- class _RegisterScreen3 extends State<RegisterScreen3> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text('Register Screen'),
- ),
- body: Center(
- child: SizedBox(
- width: 300,
- child: Column(children: <Widget>[
- const SizedBox(height: 30),
- Text(
- 'User details',
- style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
- ),
- const SizedBox(height: 30),
- Image.asset(
- 'assets/id-card.png',
- width: 150,
- ),
- const SizedBox(height: 30),
- TextField(
- decoration: InputDecoration(
- hintText: 'Username',
- ),
- ),
- const SizedBox(height: 10),
- TextField(
- decoration: InputDecoration(
- hintText: 'Password',
- ),
- ),
- const SizedBox(height: 10),
- TextField(
- decoration: InputDecoration(
- hintText: 'Repeat password',
- ),
- ),
- const SizedBox(height: 10),
- const SizedBox(height: 10),
- ElevatedButton(
- onPressed: () {},
- child: const Text('Finish'),
- ),
- ]),
- )),
- );
- }
- }
- class LogIn extends StatefulWidget {
- const LogIn({Key? key, required this.title}) : super(key: key);
- final String title;
- @override
- //_RegisterScreen createState() => _RegisterScreen();
- State<LogIn> createState() => _LogIn();
- }
- class _LogIn extends State<LogIn> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text('Login Screen'),
- ),
- body: Center(
- child: SizedBox(
- width: 300,
- child: Column(children: <Widget>[
- const SizedBox(height: 30),
- Text(
- 'Welcome back!',
- style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
- ),
- const SizedBox(height: 30),
- Image.asset(
- 'assets/hello.png',
- width: 150,
- ),
- const SizedBox(height: 30),
- TextField(
- decoration: InputDecoration(
- hintText: 'Mail or mobile phone',
- ),
- ),
- const SizedBox(height: 10),
- TextField(
- decoration: InputDecoration(
- hintText: 'Password',
- ),
- ),
- const SizedBox(height: 10),
- ElevatedButton(
- onPressed: () {},
- child: const Text('Log In'),
- ),
- ]),
- )),
- );
- }
- }
|