Skip to content

Commit

Permalink
animation and Ui updated
Browse files Browse the repository at this point in the history
  • Loading branch information
jahidRatul committed Dec 26, 2019
1 parent 61700ce commit e7bdfdf
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 118 deletions.
29 changes: 29 additions & 0 deletions lib/components/rounded_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';

class RoundedButton extends StatelessWidget {
RoundedButton({this.title, this.colour, @required this.onPressed});
final Color colour;
final String title;
final Function onPressed;

@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Material(
elevation: 5.0,
color: colour,
borderRadius: BorderRadius.circular(30.0),
child: MaterialButton(
onPressed: onPressed,
minWidth: 200.0,
height: 42.0,
child: Text(
title,
style: TextStyle(color: Colors.white),
),
),
),
);
}
}
35 changes: 35 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';

const kSendButtonTextStyle = TextStyle(
color: Colors.lightBlueAccent,
fontWeight: FontWeight.bold,
fontSize: 18.0,
);

const kMessageTextFieldDecoration = InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
hintText: 'Type your message here...',
border: InputBorder.none,
);

const kMessageContainerDecoration = BoxDecoration(
border: Border(
top: BorderSide(color: Colors.lightBlueAccent, width: 2.0),
),
);

const kTextFieldDecoration = InputDecoration(
hintText: 'Enter value',
contentPadding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(32.0)),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueAccent, width: 1.0),
borderRadius: BorderRadius.all(Radius.circular(32.0)),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueAccent, width: 2.0),
borderRadius: BorderRadius.all(Radius.circular(32.0)),
),
);
5 changes: 0 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ class FunChat extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
textTheme: TextTheme(
body1: TextStyle(color: Colors.black54),
),
),
initialRoute: WelcomeScreen.id,
routes: {
WelcomeScreen.id: (context) => WelcomeScreen(),
Expand Down
7 changes: 4 additions & 3 deletions lib/screens/chat_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:chat_with_fun/constants.dart';

class ChatScreen extends StatefulWidget {
static String id = 'chat_screen';
Expand Down Expand Up @@ -28,7 +29,7 @@ class _ChatScreenState extends State<ChatScreen> {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
//decoration: messageContainerDecoration,
decoration: kMessageContainerDecoration,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expand All @@ -37,7 +38,7 @@ class _ChatScreenState extends State<ChatScreen> {
onChanged: (value) {
//Do something with the user input.
},
// decoration: messageTextFieldDecoration,
decoration: kMessageTextFieldDecoration,
),
),
FlatButton(
Expand All @@ -46,7 +47,7 @@ class _ChatScreenState extends State<ChatScreen> {
},
child: Text(
'Send',
// style: sendButtonTextStyle,
style: kSendButtonTextStyle,
),
),
],
Expand Down
22 changes: 5 additions & 17 deletions lib/screens/login_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:chat_with_fun/components/rounded_button.dart';

class LoginScreen extends StatefulWidget {
static String id = 'login_screen';
Expand Down Expand Up @@ -79,23 +80,10 @@ class _LoginScreenState extends State<LoginScreen> {
SizedBox(
height: 24.0,
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Material(
color: Colors.lightBlueAccent,
borderRadius: BorderRadius.circular(30.0),
elevation: 5.0,
child: MaterialButton(
onPressed: () {
//Implement login functionality.
},
minWidth: 200.0,
height: 42.0,
child: Text(
'Log In',
),
),
),
RoundedButton(
title: 'Log In',
colour: Colors.lightBlueAccent,
onPressed: () {},
),
],
),
Expand Down
59 changes: 8 additions & 51 deletions lib/screens/registration_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:chat_with_fun/constants.dart';
import 'package:flutter/material.dart';
import 'package:chat_with_fun/components/rounded_button.dart';

class RegistrationScreen extends StatefulWidget {
static String id = 'registration_screen';
Expand Down Expand Up @@ -31,22 +33,8 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
onChanged: (value) {
//Do something with the user input.
},
decoration: InputDecoration(
hintText: 'Enter your email',
contentPadding:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueAccent, width: 1.0),
borderRadius: BorderRadius.circular(32.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueAccent, width: 2.0),
borderRadius: BorderRadius.circular(32.0),
),
),
decoration:
kTextFieldDecoration.copyWith(hintText: 'Enter Your Email'),
),
SizedBox(
height: 8.0,
Expand All @@ -55,45 +43,14 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
onChanged: (value) {
//Do something with the user input.
},
decoration: InputDecoration(
hintText: 'Enter yourpassword',
contentPadding:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueAccent, width: 1.0),
borderRadius: BorderRadius.circular(32.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueAccent, width: 2.0),
borderRadius: BorderRadius.circular(32.0),
),
),
decoration: kTextFieldDecoration.copyWith(
hintText: 'Enter Your Password'),
),
SizedBox(
height: 24.0,
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Material(
color: Colors.blueAccent,
borderRadius: BorderRadius.circular(30.0),
elevation: 5.0,
child: MaterialButton(
onPressed: () {
//Implement registration functionality.
},
minWidth: 200.0,
height: 42.0,
child: Text(
'Register',
style: TextStyle(color: Colors.white),
),
),
),
),
RoundedButton(
title: 'Register', colour: Colors.blueAccent, onPressed: () {}),
],
),
),
Expand Down
96 changes: 55 additions & 41 deletions lib/screens/welcome_screen.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,49 @@
import 'package:flutter/material.dart';
import 'login_screen.dart';
import 'registration_screen.dart';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:chat_with_fun/components/rounded_button.dart';

class WelcomeScreen extends StatefulWidget {
static String id = 'welcome_screen';
@override
_WelcomeScreenState createState() => _WelcomeScreenState();
}

class _WelcomeScreenState extends State<WelcomeScreen> {
class _WelcomeScreenState extends State<WelcomeScreen>
with SingleTickerProviderStateMixin {
AnimationController controller;
Animation animation;

@override
void initState() {
super.initState();

controller = AnimationController(
duration: Duration(seconds: 3),
vsync: this,
);

animation =
ColorTween(begin: Colors.grey, end: Colors.white).animate(controller);

controller.forward();

controller.addListener(() {
setState(() {});
});
}

@override
void dispose() {
controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
backgroundColor: animation.value,
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
Expand All @@ -25,57 +56,40 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
tag: 'chat',
child: Container(
child: Image.asset('images/chat.png'),
height: 60.0,
height: 60,
),
),
Text(
'Fun Chat',
style: TextStyle(
ColorizeAnimatedTextKit(
text: ['Fun Chat'],
textStyle: TextStyle(
fontSize: 45.0,
fontWeight: FontWeight.w900,
),
colors: [
Colors.purple,
Colors.blue,
Colors.yellow,
Colors.red,
],
),
],
),
SizedBox(
height: 48.0,
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Material(
elevation: 5.0,
color: Colors.lightBlueAccent,
borderRadius: BorderRadius.circular(30.0),
child: MaterialButton(
onPressed: () {
Navigator.pushNamed(context, LoginScreen.id);
},
minWidth: 200.0,
height: 42.0,
child: Text(
'Log In',
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Material(
color: Colors.blueAccent,
borderRadius: BorderRadius.circular(30.0),
elevation: 5.0,
child: MaterialButton(
onPressed: () {
Navigator.pushNamed(context, RegistrationScreen.id);
},
minWidth: 200.0,
height: 42.0,
child: Text(
'Register',
),
),
),
RoundedButton(
title: 'Log In',
colour: Colors.lightBlueAccent,
onPressed: () {
Navigator.pushNamed(context, LoginScreen.id);
},
),
RoundedButton(
title: 'Register',
colour: Colors.blueAccent,
onPressed: () {
Navigator.pushNamed(context, RegistrationScreen.id);
})
],
),
),
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
animated_text_kit:
dependency: "direct main"
description:
name: animated_text_kit
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
archive:
dependency: transitive
description:
Expand Down Expand Up @@ -193,3 +200,4 @@ packages:
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
flutter: ">=0.3.0 <2.0.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
animated_text_kit: ^2.0.0

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:chat_with_fun/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpWidget(FunChat());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
Expand Down

0 comments on commit e7bdfdf

Please sign in to comment.