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 all 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.
145 changes: 145 additions & 0 deletions client/lib/Screens/login/login_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
return Scaffold(
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.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) {
TextTheme texttheme = Theme.of(context).textTheme;
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: texttheme.headline1,
),
Text(
"If you don't have an account",
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
style: texttheme.subtitle2,
),
Row(
children: [
RichText(
text: TextSpan(
text: 'You can',
style: texttheme.subtitle2,
),
),
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: [
const TextField(
decoration: InputDecoration(
hintText: 'Enter email or Phone number',
sumit-158 marked this conversation as resolved.
Show resolved Hide resolved
labelStyle: TextStyle(fontSize: 12),
),
),
const SizedBox(height: 30),
const 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,
),
labelStyle: TextStyle(fontSize: 12),
),
),
const SizedBox(
height: 40,
),
Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(30),
),
child: ElevatedButton(
onPressed: () => ("it's pressed"),
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
),
child: const SizedBox(
width: double.infinity,
height: 50,
child: Center(child: Text('Sign In'))),
),
),
const SizedBox(height: 40),
],
);
}
}
61 changes: 6 additions & 55 deletions client/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:client/Screens/login/login_screen.dart';
import 'package:client/themes/theme_constants.dart';
import 'package:flutter/material.dart';

void main() {
Expand All @@ -11,60 +13,9 @@ 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: lightTheme,
home: const LoginScreen(),
debugShowCheckedModeBanner: false);
}
}
64 changes: 64 additions & 0 deletions client/lib/themes/theme_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import 'package:flutter/material.dart';

Color primary = const Color(0xFFFF8714);
Color onprimary = const Color(0xFF000000);
Color secondary = const Color(0xFFF5F5F5);
Color onsecondary = const Color(0xFFFFFFFF);
Color background = const Color(0xFFFFFFFF);

ThemeData lightTheme = ThemeData(
brightness: Brightness.light,
primaryColor: primary,
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: primary,
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
shape: MaterialStateProperty.all<OutlinedBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
),
backgroundColor: MaterialStateProperty.all<Color>(primary),
),
),
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15), borderSide: BorderSide.none),
filled: true,
fillColor: secondary.withOpacity(1.0),
suffixIconColor: Colors.grey,
contentPadding: const EdgeInsetsDirectional.only(start: 30),
),
textTheme: const TextTheme(
headline1: TextStyle(
fontSize: 45.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
headline2: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
headline3: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
headline4: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
bodyText2: TextStyle(
fontSize: 14,
letterSpacing: 0.5,
),
subtitle1: TextStyle(
fontSize: 14.0,
),
subtitle2: TextStyle(
fontSize: 12.0,
),
),
);
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