Selaa lähdekoodia

LogIn & Register graphic only

David Sokol Zelazko 3 vuotta sitten
vanhempi
sitoutus
970c59f230
1 muutettua tiedostoa jossa 332 lisäystä ja 7 poistoa
  1. 332 7
      app/lib/main.dart

+ 332 - 7
app/lib/main.dart

@@ -15,24 +15,349 @@ class PhysiGo extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return MaterialApp(
-      title: 'PhysiGo',
+      title: 'PhsyGo',
       theme: ThemeData(
-        primarySwatch: Colors.blue,
+        primarySwatch: Colors.blueGrey,
       ),
-      home: const HomePage(),
+      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 HomePage extends StatelessWidget {
-  const HomePage({Key? key}) : super(key: key);
+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 Scaffold(
+      appBar: AppBar(
+        title: const Text('Welcome to PhysiGo'),
+      ),
+      body: Center(
+        child: Column(
+          children: <Widget>[
+            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 const Scaffold(
+    return Scaffold(
+      appBar: AppBar(
+        title: const Text('Register Screen'),
+      ),
       body: Center(
-        child: Text("Home"),
+          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'),
+              ),
+
+
+            ]),
+          )),
+    );
+  }
+}