Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

fix(entire app): fix small design bugs, keyboard focusing issue, stor… #118

Merged
merged 1 commit into from
May 6, 2019
Merged
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
7 changes: 5 additions & 2 deletions fude_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
MainModel _model = MainModel();

_model.fetchUser();
return ScopedModel<MainModel>(model: _model, child: _buildApp(context));
_model.getThemeFromPrefs();
return ScopedModel<MainModel>(
model: _model,
child: _buildApp(context),
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ForgotPassButton extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
child: Text(
"reset",
"reset password",
style: TextStyle(
color: Theme.of(context).secondaryHeaderColor,
fontSize: 20.0,
Expand Down
111 changes: 63 additions & 48 deletions fude_app/lib/pages/auth/login/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,28 @@ class _LoginPageState extends State<LoginPage> with TickerProviderStateMixin {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Oops!'),
content: Text(userMessage),
actions: <Widget>[
FlatButton(
child: Text('Okay'),
onPressed: () {
Navigator.of(context).pop();
},
)
],
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
backgroundColor: Theme.of(context).primaryColor,
title: Text(
'Aw Geeze!',
style: TextStyle(
color: Theme.of(context).secondaryHeaderColor,
fontWeight: FontWeight.bold,
fontSize: 30,
letterSpacing: 8,
),
),
content: Text(
userMessage,
style: TextStyle(
color: Theme.of(context).secondaryHeaderColor,
// fontWeight: FontWeight.bold,
fontSize: 20,
letterSpacing: 3,
),
),
actions: <Widget>[],
);
},
);
Expand All @@ -99,49 +111,52 @@ class _LoginPageState extends State<LoginPage> with TickerProviderStateMixin {
builder: (BuildContext context, Widget child, MainModel model) {
return Scaffold(
body: Container(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor),
child: ListView(
padding: EdgeInsets.all(0.0),
decoration:
BoxDecoration(color: Theme.of(context).secondaryHeaderColor),
child: ListView(
padding: EdgeInsets.all(0.0),
children: <Widget>[
Stack(
alignment: AlignmentDirectional.bottomCenter,
children: <Widget>[
Stack(
alignment: AlignmentDirectional.bottomCenter,
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Logo(),
model.resetLinkSent
? Text(
'check your email!',
style: TextStyle(
color: Theme.of(context).primaryColor),
)
: Container(),
FormContainer(
formKey: formKey,
updateEmail: updateEmail,
updatePassword: updatePassword,
isLogin: isLogin),
SignUp()
],
),
Padding(
padding: EdgeInsets.only(bottom: 50.0),
child: InkWell(
onTap: () {
setState(() {
animationStatus = 1;
});
_submitForm(login: model.login);
},
child: LoginInButton()),
)
Logo(),
model.resetLinkSent
? Text(
'check your email!',
style: TextStyle(
color: Theme.of(context).primaryColor),
)
: Container(),
FormContainer(
formKey: formKey,
updateEmail: updateEmail,
updatePassword: updatePassword,
isLogin: isLogin),
SignUp()
],
),
Padding(
padding: EdgeInsets.only(bottom: 50.0),
child: InkWell(
onTap: () {
setState(() {
animationStatus = 1;
});
_submitForm(login: model.login);
},
child: !model.isLoading
? LoginInButton()
: CircularProgressIndicator(
strokeWidth: 6,
)),
)
],
))),
),
],
)),
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion fude_app/lib/pages/auth/signup/forgotpass_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ForgotPassword extends StatelessWidget {
style: TextStyle(
fontWeight: FontWeight.w300,
letterSpacing: 0.5,
color: Colors.white,
color: Theme.of(context).primaryColor,
fontSize: 12.0),
),
),
Expand Down
1 change: 1 addition & 0 deletions fude_app/lib/pages/auth/signup/signup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class _SignUpState extends State<SignUpPage> with TickerProviderStateMixin {
setState(() {
animationStatus = 1;
});
model.resetUsersJars();
_submitForm(register: model.register);
},
child: SignUpButton()),
Expand Down
166 changes: 92 additions & 74 deletions fude_app/lib/pages/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,25 @@ class _HomePageState extends State<HomePage> {
super.initState();
}

void _openJar(int index) {
widget.model.getJarBySelectedId(widget.model.usersJars[index].documentID);
Timer(Duration(milliseconds: 500), () {
Navigator.push(
context,
PageTransition(
curve: Curves.linear,
type: PageTransitionType.downToUp,
child: JarPage(model: widget.model),
),
);
Timer(Duration(seconds: 2), () => widget.model.resetIsLoading());
});
}

@override
Widget build(BuildContext context) {
final double width = MediaQuery.of(context).size.width;
final double height = MediaQuery.of(context).size.height;
// print('LIST in BUILD ${widget.model.usersJars[0].runtimeType}');

return Scaffold(
appBar: AppBar(
title: Container(
Expand All @@ -55,85 +68,90 @@ class _HomePageState extends State<HomePage> {
automaticallyImplyLeading: false,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: FloatingActionButton(
shape: CircleBorder(),
elevation: 0,
backgroundColor: Theme.of(context).primaryColor,
foregroundColor: Theme.of(context).primaryColor,
highlightElevation: 0,
onPressed: () => widget.model.invertTheme(),
child:
Theme.of(context).primaryColor == Color.fromRGBO(242, 242, 242, 1)
? Image.asset(
'assets/IconDark.png',
height: height * 0.2,
width: width * 0.2,
)
: Image.asset(
'assets/IconLight.png',
height: height * 0.2,
width: width * 0.2,
),
floatingActionButton: Padding(
padding: EdgeInsets.only(bottom: height * 0.08),
child: FloatingActionButton(
shape: CircleBorder(),
elevation: 0,
backgroundColor: Theme.of(context).primaryColor,
foregroundColor: Theme.of(context).primaryColor,
highlightElevation: 0,
onPressed: () => widget.model.invertTheme(),
child: !widget.model.isLoading
? Theme.of(context).primaryColor ==
Color.fromRGBO(242, 242, 242, 1)
? Image.asset(
'assets/IconDark.png',
height: height * 0.2,
width: width * 0.2,
)
: Image.asset(
'assets/IconLight.png',
height: height * 0.2,
width: width * 0.2,
)
: Container(),
),
),
bottomNavigationBar: BottomAppBar(
color: Theme.of(context).primaryColor,
elevation: 0,
child: Container(height: 20),
),
body: Container(
height: height,
width: width,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
widget.model.usersJars.length == 0
? Center(
child: CircularProgressIndicator(),
)
: Container(
margin: EdgeInsets.fromLTRB(0, height * 0.1, 0, 0),
width: width,
height: height * 0.55,
child: PageView.builder(
reverse: false,
pageSnapping: true,
controller: PageController(
keepPage: false,
viewportFraction: 0.88,
initialPage: 0),
itemCount: widget.model.usersJars.length,
itemBuilder: (context, index) {
return index == 0
? HomePageJar(
model: widget.model, title: 'Add Jar')
: GestureDetector(
onTap: () {
widget.model.getJarBySelectedId(widget
.model.usersJars[index].documentID);
Timer(Duration(milliseconds: 500), () {
Navigator.push(
context,
PageTransition(
curve: Curves.linear,
type: PageTransitionType.downToUp,
child: JarPage(model: widget.model),
),
body: !widget.model.isLoading
? Container(
height: height,
width: width,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
widget.model.usersJars.length == 0
? Center(
child: CircularProgressIndicator(),
)
: Container(
margin: EdgeInsets.fromLTRB(0, height * 0.1, 0, 0),
width: width,
height: height * 0.55,
child: PageView.builder(
reverse: false,
pageSnapping: true,
controller: PageController(
keepPage: false,
viewportFraction: 0.8,
initialPage: 0),
itemCount: widget.model.usersJars.length,
itemBuilder: (context, index) {
return index == 0
? HomePageJar(
model: widget.model, title: 'Add Jar')
: GestureDetector(
onTap: () => _openJar(index),
child: HomePageJar(
model: widget.model,
jar: widget.model.usersJars[index],
title: null),
);
});
},
child: HomePageJar(
model: widget.model,
jar: widget.model.usersJars[index],
title: null),
);
}),
)
],
),
),
}),
)
],
),
)
: Container(
height: height,
width: width,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
),
child: Center(
child: CircularProgressIndicator(
strokeWidth: 6,
),
),
),
);
}
}
11 changes: 6 additions & 5 deletions fude_app/lib/pages/home/home_page_jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,12 @@ class HomePageJar extends StatelessWidget {
color: Theme.of(context).textTheme.subhead.color,
onPressed: () {
model.categoryChildren = [];
model.getJarBySelectedId(jar.documentID);
Navigator.push(
context,
PageTransition(
curve: Curves.linear,
type: PageTransitionType.downToUp,
child: EditJarPage(model: model),
child: EditJarPage(model: model, jar: jar),
),
);
},
Expand Down Expand Up @@ -129,8 +128,9 @@ class HomePageJar extends StatelessWidget {
@override
Widget build(BuildContext context) {
Image jarImage = Image(
image: jar != null ? NetworkImage(
jar.data['image']) : AssetImage('assets/logo.png'),
image: jar != null
? NetworkImage(jar.data['image'])
: AssetImage('assets/logo.png'),
fit: BoxFit.cover,
alignment: FractionalOffset(
0.5,
Expand Down Expand Up @@ -175,7 +175,8 @@ class HomePageJar extends StatelessWidget {
child: Material(
elevation: model.darkTheme ? 4.0 : 8,
shadowColor: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.all(Radius.circular(30)),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.all(Radius.circular(35)),
child: Stack(
fit: StackFit.expand,
children: [
Expand Down
Loading