mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Simplify user page
This commit is contained in:
parent
824be11013
commit
69f8710f31
@ -3,7 +3,7 @@ import 'package:comunic/helpers/posts_helper.dart';
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/models/advanced_user_info.dart';
|
||||
import 'package:comunic/ui/routes/home_route.dart';
|
||||
import 'package:comunic/ui/widgets/network_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/post_create_form_widget.dart';
|
||||
import 'package:comunic/ui/widgets/posts_list_widget.dart';
|
||||
import 'package:comunic/ui/widgets/scroll_watcher.dart';
|
||||
@ -37,7 +37,6 @@ class _UserPageScreenState extends State<UserPageScreen> {
|
||||
final PostsHelper _postsHelper = PostsHelper();
|
||||
|
||||
// Objects members
|
||||
final double _appBarHeight = 256.0;
|
||||
_PageStatus _status = _PageStatus.LOADING;
|
||||
AdvancedUserInfo _userInfo;
|
||||
GlobalKey<RefreshIndicatorState> _refreshIndicatorKey =
|
||||
@ -93,8 +92,8 @@ class _UserPageScreenState extends State<UserPageScreen> {
|
||||
return Scaffold(
|
||||
body: RefreshIndicator(
|
||||
key: _refreshIndicatorKey,
|
||||
child: CustomScrollView(
|
||||
slivers: <Widget>[_buildHeader(), _buildBody()],
|
||||
child: ListView(
|
||||
children: <Widget>[_buildHeader(), _buildBody()],
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
controller: _scrollWatcher,
|
||||
),
|
||||
@ -124,54 +123,22 @@ class _UserPageScreenState extends State<UserPageScreen> {
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return SliverAppBar(
|
||||
expandedHeight: _appBarHeight,
|
||||
floating: false,
|
||||
pinned: true,
|
||||
snap: false,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
title: Text(_userInfo.displayName),
|
||||
background: Stack(
|
||||
fit: StackFit.expand,
|
||||
return Container(
|
||||
color: Colors.black26,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
NetworkImageWidget(
|
||||
url: _userInfo.accountImageURL,
|
||||
height: _appBarHeight,
|
||||
roundedEdges: false,
|
||||
),
|
||||
// This gradient ensures that the toolbar icons are distinct
|
||||
// against the background image.
|
||||
const DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment(0.0, -1.0),
|
||||
end: Alignment(0.0, -0.4),
|
||||
colors: <Color>[Color(0x60000000), Color(0x00000000)],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment(0.0, 0.4),
|
||||
end: Alignment(0.0, 0.9),
|
||||
colors: <Color>[Color(0x00000000), Color(0x60000000)],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
AccountImageWidget(user: _userInfo),
|
||||
Text(" ${_userInfo.displayName}"),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.chat,
|
||||
),
|
||||
onPressed: () {
|
||||
openPrivateConversation(context, widget.userID);
|
||||
},
|
||||
),
|
||||
}),
|
||||
PopupMenuButton<_MenuOptions>(
|
||||
itemBuilder: (c) => [
|
||||
PopupMenuItem(
|
||||
@ -183,13 +150,14 @@ class _UserPageScreenState extends State<UserPageScreen> {
|
||||
onSelected: _selectedMenuOption,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody() {
|
||||
return SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
<Widget>[
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
// Posts create form
|
||||
_userInfo.canPostTexts
|
||||
? PostCreateFormWidget(
|
||||
@ -209,7 +177,6 @@ class _UserPageScreenState extends State<UserPageScreen> {
|
||||
buildListView: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user