Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
o1298098 committed Apr 11, 2020
1 parent f6762bf commit 81e928c
Show file tree
Hide file tree
Showing 28 changed files with 451 additions and 364 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies

Large diffs are not rendered by default.

Binary file modified android/.gradle/4.10.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified android/.gradle/4.10.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified android/.gradle/4.10.2/taskHistory/taskHistory.bin
Binary file not shown.
Binary file modified android/.gradle/4.10.2/taskHistory/taskHistory.lock
Binary file not shown.
Binary file modified android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
3 changes: 3 additions & 0 deletions lib/views/account_page/state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
import 'package:movie/globalbasestate/state.dart';

class AccountPageState implements GlobalBaseState, Cloneable<AccountPageState> {
GlobalKey<ScaffoldState> scafoldState =
GlobalKey<ScaffoldState>(debugLabel: 'accountPageScafold');
String name;
String avatar;
bool islogin;
Expand All @@ -25,6 +27,7 @@ class AccountPageState implements GlobalBaseState, Cloneable<AccountPageState> {
..themeIndex = themeIndex
..locale = locale
..themeColor = themeColor
..scafoldState = scafoldState
..user = user;
}

Expand Down
129 changes: 93 additions & 36 deletions lib/views/account_page/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:movie/actions/adapt.dart';
import 'package:movie/customwidgets/customcliper_path.dart';
import 'package:movie/views/main_page/action.dart';

import 'action.dart';
import 'state.dart';
Expand Down Expand Up @@ -52,7 +53,7 @@ Widget buildView(
width: Adapt.px(40),
),
SizedBox(
width: Adapt.screenW() - Adapt.px(200),
width: Adapt.screenW() - Adapt.px(225),
child: Text(
'Hi, ${state.user?.displayName ?? 'Guest'}',
maxLines: 1,
Expand All @@ -67,19 +68,61 @@ Widget buildView(
Expanded(
child: SizedBox(),
),
IconButton(
iconSize: Adapt.px(50),
onPressed: () {
if (state.islogin)
dispatch(AccountPageActionCreator.onLogout());
else
dispatch(AccountPageActionCreator.onLogin());
},
icon: Icon(
state.islogin ? Icons.exit_to_app : Icons.person_outline,
color: Colors.white,
),
),
state.user == null
? InkWell(
onTap: () => dispatch(AccountPageActionCreator.onLogin()),
child: Container(
height: Adapt.px(60),
margin: EdgeInsets.only(
right: Adapt.px(30),
top: Adapt.px(13),
bottom: Adapt.px(13)),
padding: EdgeInsets.symmetric(
horizontal: Adapt.px(20), vertical: Adapt.px(10)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Adapt.px(30)),
border: Border.all(
color: const Color(0xFFFFFFFF), width: 2)),
child: Text(
'Sign In',
style: TextStyle(
color: const Color(0xFFFFFFFF),
fontSize: Adapt.px(26)),
)))
: PopupMenuButton<String>(
padding: EdgeInsets.zero,
offset: Offset(0, Adapt.px(100)),
icon: Icon(
Icons.more_vert,
color: const Color(0xFFFFFFFF),
size: Adapt.px(50),
),
onSelected: (selected) {
switch (selected) {
case 'Sign Out':
dispatch(AccountPageActionCreator.onLogout());
break;
}
},
itemBuilder: (ctx) {
return [
PopupMenuItem<String>(
value: 'Notifications',
child: const _DropDownItem(
title: 'Notifications',
icon: Icons.notifications_none,
),
),
PopupMenuItem<String>(
value: 'Sign Out',
child: const _DropDownItem(
title: 'Sign Out',
icon: Icons.exit_to_app,
),
),
];
},
),
SizedBox(
width: Adapt.px(10),
)
Expand Down Expand Up @@ -162,29 +205,43 @@ Widget buildView(
}

return Scaffold(
key: state.scafoldState,
endDrawer: Drawer(),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Stack(
children: <Widget>[
_buildBackGround(),
Container(
child: SafeArea(
child: Column(
children: <Widget>[
SizedBox(
height: Adapt.px(60),
),
_buildHeader(),
SizedBox(
height: Adapt.px(50),
physics: BouncingScrollPhysics(),
child: Stack(
children: <Widget>[
_buildBackGround(),
Container(
child: SafeArea(
child: Column(
children: <Widget>[
SizedBox(
height: Adapt.px(60),
),
_buildHeader(),
SizedBox(
height: Adapt.px(50),
),
_buildBody(),
],
),
_buildBody(),
],
),
),
)
],
),
));
),
)
],
),
));
});
}

class _DropDownItem extends StatelessWidget {
final String title;
final IconData icon;
const _DropDownItem({@required this.title, this.icon});
@override
Widget build(BuildContext context) {
return Row(
children: <Widget>[Icon(icon), SizedBox(width: 10), Text(title)],
);
}
}
56 changes: 34 additions & 22 deletions lib/views/home_page/components/header_component/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ Widget buildView(
itemBuilder: (_, index) {
final _d = _model.results[index];
return _HeaderListCell(
data: _model.results[index],
onTap: () => dispatch(HomePageActionCreator.onCellTapped(
data: _model.results[index],
onTap: () => dispatch(
HomePageActionCreator.onCellTapped(
_d.id,
_d.backdropPath,
_d.title ?? _d.name,
_d.posterPath,
state.showHeaderMovie
? MediaType.movie
: MediaType.tv)));
: MediaType.tv),
),
);
})
: _ShimmerHeaderList(),
),
Expand Down Expand Up @@ -149,16 +152,17 @@ class _ShimmerHeaderList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Shimmer.fromColors(
baseColor: _baseColor,
highlightColor: _highLightColor,
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: Adapt.px(30)),
physics: BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
itemCount: 4,
itemBuilder: (context, index) => _ShimmerHeaderCell(),
separatorBuilder: (context, index) => SizedBox(width: Adapt.px(30)),
));
baseColor: _baseColor,
highlightColor: _highLightColor,
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: Adapt.px(30)),
physics: BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
itemCount: 4,
itemBuilder: (context, index) => _ShimmerHeaderCell(),
separatorBuilder: (context, index) => SizedBox(width: Adapt.px(30)),
),
);
}
}

Expand All @@ -178,11 +182,14 @@ class _HeaderListCell extends StatelessWidget {
width: Adapt.px(200),
height: Adapt.px(280),
decoration: BoxDecoration(
color: Color.fromRGBO(57, 57, 57, 1),
image: DecorationImage(
fit: BoxFit.cover,
image: CachedNetworkImageProvider(
ImageUrl.getUrl(data.posterPath, ImageSize.w300)))),
color: Color.fromRGBO(57, 57, 57, 1),
image: DecorationImage(
fit: BoxFit.cover,
image: CachedNetworkImageProvider(
ImageUrl.getUrl(data.posterPath, ImageSize.w300),
),
),
),
),
),
SizedBox(
Expand All @@ -192,10 +199,15 @@ class _HeaderListCell extends StatelessWidget {
alignment: Alignment.center,
width: Adapt.px(200),
height: Adapt.px(70),
child: Text(name,
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(color: Colors.grey, fontSize: Adapt.px(26))),
child: Text(
name,
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey,
fontSize: Adapt.px(26),
),
),
),
],
);
Expand Down
47 changes: 26 additions & 21 deletions lib/views/home_page/components/popularposter_cpmponent/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,28 +209,33 @@ class _Cell extends StatelessWidget {
child: Column(
children: <Widget>[
Container(
width: Adapt.px(250),
height: Adapt.px(350),
decoration: BoxDecoration(
color: _theme.primaryColorDark,
borderRadius: BorderRadius.circular(Adapt.px(15)),
image: DecorationImage(
fit: BoxFit.cover,
image: CachedNetworkImageProvider(
ImageUrl.getUrl(data.posterPath, ImageSize.w400))))),
Container(
//alignment: Alignment.bottomCenter,
width: Adapt.px(250),
padding: EdgeInsets.all(Adapt.px(10)),
child: Text(
data.title ?? data.name,
maxLines: 2,
//textAlign: TextAlign.center,
style: TextStyle(
fontSize: Adapt.px(28),
fontWeight: FontWeight.bold,
width: Adapt.px(250),
height: Adapt.px(350),
decoration: BoxDecoration(
color: _theme.primaryColorDark,
borderRadius: BorderRadius.circular(Adapt.px(15)),
image: DecorationImage(
fit: BoxFit.cover,
image: CachedNetworkImageProvider(
ImageUrl.getUrl(data.posterPath, ImageSize.w400),
),
))
),
),
),
Container(
//alignment: Alignment.bottomCenter,
width: Adapt.px(250),
padding: EdgeInsets.all(Adapt.px(10)),
child: Text(
data.title ?? data.name,
maxLines: 2,
//textAlign: TextAlign.center,
style: TextStyle(
fontSize: Adapt.px(28),
fontWeight: FontWeight.bold,
),
),
)
],
),
);
Expand Down
22 changes: 13 additions & 9 deletions lib/views/home_page/components/share_component/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,19 @@ class _Cell extends StatelessWidget {
child: Column(
children: <Widget>[
Container(
width: Adapt.px(250),
height: Adapt.px(350),
decoration: BoxDecoration(
color: _theme.primaryColorDark,
borderRadius: BorderRadius.circular(Adapt.px(15)),
image: DecorationImage(
fit: BoxFit.cover,
image: CachedNetworkImageProvider(
ImageUrl.getUrl(data.photourl, ImageSize.w400))))),
width: Adapt.px(250),
height: Adapt.px(350),
decoration: BoxDecoration(
color: _theme.primaryColorDark,
borderRadius: BorderRadius.circular(Adapt.px(15)),
image: DecorationImage(
fit: BoxFit.cover,
image: CachedNetworkImageProvider(
ImageUrl.getUrl(data.photourl, ImageSize.w400),
),
),
),
),
Container(
//alignment: Alignment.bottomCenter,
width: Adapt.px(250),
Expand Down
Loading

0 comments on commit 81e928c

Please sign in to comment.