chore: Improved create group and space design
This commit is contained in:
parent
cf59a43511
commit
152fcc0d95
3 changed files with 50 additions and 97 deletions
|
|
@ -19,8 +19,6 @@ class NewGroup extends StatefulWidget {
|
||||||
class NewGroupController extends State<NewGroup> {
|
class NewGroupController extends State<NewGroup> {
|
||||||
TextEditingController nameController = TextEditingController();
|
TextEditingController nameController = TextEditingController();
|
||||||
|
|
||||||
TextEditingController topicController = TextEditingController();
|
|
||||||
|
|
||||||
bool publicGroup = false;
|
bool publicGroup = false;
|
||||||
bool groupCanBeFound = true;
|
bool groupCanBeFound = true;
|
||||||
|
|
||||||
|
|
@ -71,11 +69,6 @@ class NewGroupController extends State<NewGroup> {
|
||||||
: sdk.CreateRoomPreset.privateChat,
|
: sdk.CreateRoomPreset.privateChat,
|
||||||
groupName: nameController.text.isNotEmpty ? nameController.text : null,
|
groupName: nameController.text.isNotEmpty ? nameController.text : null,
|
||||||
initialState: [
|
initialState: [
|
||||||
if (topicController.text.isNotEmpty)
|
|
||||||
sdk.StateEvent(
|
|
||||||
type: sdk.EventTypes.RoomTopic,
|
|
||||||
content: {'topic': topicController.text},
|
|
||||||
),
|
|
||||||
if (avatar != null)
|
if (avatar != null)
|
||||||
sdk.StateEvent(
|
sdk.StateEvent(
|
||||||
type: sdk.EventTypes.RoomAvatar,
|
type: sdk.EventTypes.RoomAvatar,
|
||||||
|
|
|
||||||
|
|
@ -31,17 +31,13 @@ class NewGroupView extends StatelessWidget {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
InkWell(
|
InkWell(
|
||||||
borderRadius: BorderRadius.circular(90),
|
borderRadius: BorderRadius.circular(90),
|
||||||
onTap: controller.loading ? null : controller.selectPhoto,
|
onTap: controller.loading ? null : controller.selectPhoto,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
radius: Avatar.defaultSize / 2,
|
radius: Avatar.defaultSize,
|
||||||
child: avatar == null
|
child: avatar == null
|
||||||
? const Icon(Icons.camera_alt_outlined)
|
? const Icon(Icons.add_a_photo_outlined)
|
||||||
: ClipRRect(
|
: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(90),
|
borderRadius: BorderRadius.circular(90),
|
||||||
child: Image.memory(
|
child: Image.memory(
|
||||||
|
|
@ -53,9 +49,11 @@ class NewGroupView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(height: 32),
|
||||||
Expanded(
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
autofocus: true,
|
||||||
controller: controller.nameController,
|
controller: controller.nameController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
readOnly: controller.loading,
|
readOnly: controller.loading,
|
||||||
|
|
@ -65,23 +63,6 @@ class NewGroupView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: TextField(
|
|
||||||
controller: controller.topicController,
|
|
||||||
minLines: 4,
|
|
||||||
maxLines: 4,
|
|
||||||
maxLength: 255,
|
|
||||||
readOnly: controller.loading,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: L10n.of(context)!.addChatDescription,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
SwitchListTile.adaptive(
|
SwitchListTile.adaptive(
|
||||||
secondary: const Icon(Icons.public_outlined),
|
secondary: const Icon(Icons.public_outlined),
|
||||||
|
|
|
||||||
|
|
@ -22,26 +22,14 @@ class NewSpaceView extends StatelessWidget {
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ListTile(
|
|
||||||
trailing: const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: Icon(Icons.info_outlined),
|
|
||||||
),
|
|
||||||
subtitle: Text(L10n.of(context)!.newSpaceDescription),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
InkWell(
|
InkWell(
|
||||||
borderRadius: BorderRadius.circular(90),
|
borderRadius: BorderRadius.circular(90),
|
||||||
onTap: controller.loading ? null : controller.selectPhoto,
|
onTap: controller.loading ? null : controller.selectPhoto,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
radius: Avatar.defaultSize / 2,
|
radius: Avatar.defaultSize,
|
||||||
child: avatar == null
|
child: avatar == null
|
||||||
? const Icon(Icons.camera_alt_outlined)
|
? const Icon(Icons.add_a_photo_outlined)
|
||||||
: ClipRRect(
|
: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(90),
|
borderRadius: BorderRadius.circular(90),
|
||||||
child: Image.memory(
|
child: Image.memory(
|
||||||
|
|
@ -53,9 +41,11 @@ class NewSpaceView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(height: 32),
|
||||||
Expanded(
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
autofocus: true,
|
||||||
controller: controller.nameController,
|
controller: controller.nameController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
readOnly: controller.loading,
|
readOnly: controller.loading,
|
||||||
|
|
@ -66,30 +56,19 @@ class NewSpaceView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: TextField(
|
|
||||||
controller: controller.topicController,
|
|
||||||
minLines: 4,
|
|
||||||
maxLines: 4,
|
|
||||||
maxLength: 255,
|
|
||||||
readOnly: controller.loading,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: L10n.of(context)!.addChatDescription,
|
|
||||||
errorText: controller.topicError,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
SwitchListTile.adaptive(
|
SwitchListTile.adaptive(
|
||||||
title: Text(L10n.of(context)!.spaceIsPublic),
|
title: Text(L10n.of(context)!.spaceIsPublic),
|
||||||
value: controller.publicGroup,
|
value: controller.publicGroup,
|
||||||
onChanged: controller.setPublicGroup,
|
onChanged: controller.setPublicGroup,
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
trailing: const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: Icon(Icons.info_outlined),
|
||||||
|
),
|
||||||
|
subtitle: Text(L10n.of(context)!.newSpaceDescription),
|
||||||
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue