mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Start to build group page
This commit is contained in:
parent
bd33e1f9c2
commit
566f205dc9
61
lib/ui/screens/authorized_group_page_screen.dart
Normal file
61
lib/ui/screens/authorized_group_page_screen.dart
Normal file
@ -0,0 +1,61 @@
|
||||
import 'package:comunic/models/advanced_group_info.dart';
|
||||
import 'package:comunic/ui/widgets/group_icon_widget.dart';
|
||||
import 'package:comunic/ui/widgets/group_membership_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Authorized group page screen
|
||||
///
|
||||
/// This screen is shown when the user is allowed to access to a group's page
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class AuthorizedGroupPageScreen extends StatefulWidget {
|
||||
final AdvancedGroupInfo advancedGroupInfo;
|
||||
final Function() needRefresh;
|
||||
|
||||
const AuthorizedGroupPageScreen({
|
||||
Key key,
|
||||
@required this.advancedGroupInfo,
|
||||
@required this.needRefresh,
|
||||
}) : assert(advancedGroupInfo != null),
|
||||
assert(needRefresh != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_AuthorizedGroupPageScreenState createState() =>
|
||||
_AuthorizedGroupPageScreenState();
|
||||
}
|
||||
|
||||
class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
|
||||
AdvancedGroupInfo get _group => widget.advancedGroupInfo;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[_buildGroupPageHeader()],
|
||||
);
|
||||
}
|
||||
|
||||
/// Build group page header
|
||||
_buildGroupPageHeader() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
GroupIcon(
|
||||
group: _group,
|
||||
),
|
||||
Text(
|
||||
" ${_group.displayName}",
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
Spacer(),
|
||||
GroupMembershipWidget(
|
||||
group: _group,
|
||||
onUpdated: () => widget.needRefresh(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import 'package:comunic/helpers/groups_helper.dart';
|
||||
import 'package:comunic/ui/screens/authorized_group_page_screen.dart';
|
||||
import 'package:comunic/ui/screens/group_access_denied_screen.dart';
|
||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
@ -53,7 +54,11 @@ class _GroupPageScreenState extends SafeState<GroupPageScreen> {
|
||||
onMembershipAcquired: () => _refreshPage(),
|
||||
);
|
||||
|
||||
// Create another screen for the group page
|
||||
// Now we can show group page
|
||||
return AuthorizedGroupPageScreen(
|
||||
advancedGroupInfo: _getGroupResult.info,
|
||||
needRefresh: () => _refreshPage(),
|
||||
);
|
||||
}
|
||||
|
||||
/// Refresh the page
|
||||
|
Loading…
Reference in New Issue
Block a user