Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding authentication page UI based on Figma #12

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added client/assets/icons/release_icon_transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
187 changes: 187 additions & 0 deletions client/lib/Screens/login/login_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
// ignore_for_file: prefer_const_constructors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constant constructors are more performant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 please remove this kind of line
It's there for a reason


import 'package:flutter/material.dart';

class LoginScreen extends StatelessWidget {
const LoginScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffFFFFFF),
body: ListView(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a ListView for only two items is not recommanded.
Instead you should a SingleChildScrollView + Flex (which can be horizontal/vertical according to the space available)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't change the listview, but it is responsive now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please show me your code without the ListView please.
It should work without any issue here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

padding: EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width / 8),
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
children: const [
Menu(),
Body(),
],
),
);
}
}

class Menu extends StatelessWidget {
const Menu({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To have a consistency between all screens, could you store all dimensions in a separated file please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you mark this as resolved, as the dimension is still hardcoded?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how I can put in a centralized file? Is creating a const for appappding would be good in theme_constants file?

child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset(
'icons/release_icon_transparent.png',
width: 41,
height: 65,
)
],
),
],
),
);
}
}

class Body extends StatelessWidget {
const Body({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: 380,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
' Sign In to the\nCommunity Portal',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to use a translation service?
Hardcoded sentences are not a good behavior

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@g123k suggestions please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Sumit

You can have a look here
https://docs.flutter.dev/development/accessibility-and-localization/internationalization
Hope it might help you out

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AshAman999

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to use a translation service?
currently not , might be in future updates .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ask @teolemon how to use Crowdin (the same as Smoothie)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's as simple as tweaking the config file in the PR, with the path to the translation file (typically *.arb for flutter)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#25

style: TextStyle(
fontSize: 45,
fontWeight: FontWeight.bold,
),
),
SizedBox(
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
height: null,
),
Text(
"If you don't have an account",
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
style: TextStyle(
color: Colors.black54, fontWeight: FontWeight.bold),
),
SizedBox(
height: 10,
),
Row(
children: [
RichText(
text: TextSpan(
text: 'You can',
style: TextStyle(
color: Colors.black54, fontWeight: FontWeight.bold),
),
),
SizedBox(width: 15),
Text(
"Register here!",
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold),
),
],
),
Image.asset(
'icons/release_icon_with_name_transparent.png',
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
width: 400,
),
],
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: MediaQuery.of(context).size.height / 6),
child: SizedBox(
width: 320,
child: _formLogin(context),
),
)
],
);
}

Widget _formLogin(context) {
return Column(
children: [
TextField(
decoration: InputDecoration(
hintText: 'Enter email or Phone number',
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
filled: true,
labelStyle: TextStyle(fontSize: 12),
contentPadding: EdgeInsetsDirectional.only(start: 30),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
),
),
),
SizedBox(height: 30),
TextField(
decoration: InputDecoration(
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
hintText: 'Password',
counterText: 'Forgot password?',
suffixIcon: Icon(
Icons.visibility_off_outlined,
color: Colors.grey,
),
filled: true,
labelStyle: TextStyle(fontSize: 12),
contentPadding: EdgeInsetsDirectional.only(start: 30),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
),
),
),
SizedBox(height: 40),
Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(30),
boxShadow: [
BoxShadow(
color: Theme.of(context).primaryColor,
spreadRadius: 10,
blurRadius: 20,
),
],
),
child: ElevatedButton(
onPressed: () => ("it's pressed"),
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
onPrimary: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
),
child: SizedBox(
width: double.infinity,
height: 50,
child: Center(child: Text("Sign In"))),
),
),
SizedBox(height: 40),
],
);
}
}
65 changes: 10 additions & 55 deletions client/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:client/Screens/login/login_screen.dart';
import 'package:flutter/material.dart';

void main() {
Expand All @@ -11,60 +12,14 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
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> {
int _counter = 0;

void _incrementCounter() {
setState(() {
_counter++;
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
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(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
title: 'Community-portal',
theme: ThemeData(
primaryColor: const Color(0xffFF8714),
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
backgroundColor: const Color(0xffFFFFFF),
inputDecorationTheme: const InputDecorationTheme(
fillColor: Color(0xffF5F5F5),
)),
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
home: const LoginScreen(),
debugShowCheckedModeBanner: false);
}
}
4 changes: 2 additions & 2 deletions client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ flutter:
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
assets:
- assets/icons/
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
Expand Down