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> {
|
||||
TextEditingController nameController = TextEditingController();
|
||||
|
||||
TextEditingController topicController = TextEditingController();
|
||||
|
||||
bool publicGroup = false;
|
||||
bool groupCanBeFound = true;
|
||||
|
||||
|
|
@ -71,11 +69,6 @@ class NewGroupController extends State<NewGroup> {
|
|||
: sdk.CreateRoomPreset.privateChat,
|
||||
groupName: nameController.text.isNotEmpty ? nameController.text : null,
|
||||
initialState: [
|
||||
if (topicController.text.isNotEmpty)
|
||||
sdk.StateEvent(
|
||||
type: sdk.EventTypes.RoomTopic,
|
||||
content: {'topic': topicController.text},
|
||||
),
|
||||
if (avatar != null)
|
||||
sdk.StateEvent(
|
||||
type: sdk.EventTypes.RoomAvatar,
|
||||
|
|
|
|||
|
|
@ -31,17 +31,13 @@ class NewGroupView extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Row(
|
||||
children: [
|
||||
InkWell(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
onTap: controller.loading ? null : controller.selectPhoto,
|
||||
child: CircleAvatar(
|
||||
radius: Avatar.defaultSize / 2,
|
||||
radius: Avatar.defaultSize,
|
||||
child: avatar == null
|
||||
? const Icon(Icons.camera_alt_outlined)
|
||||
? const Icon(Icons.add_a_photo_outlined)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
child: Image.memory(
|
||||
|
|
@ -53,9 +49,11 @@ class NewGroupView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
const SizedBox(height: 32),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: controller.nameController,
|
||||
autocorrect: false,
|
||||
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),
|
||||
SwitchListTile.adaptive(
|
||||
secondary: const Icon(Icons.public_outlined),
|
||||
|
|
|
|||
|
|
@ -22,26 +22,14 @@ class NewSpaceView extends StatelessWidget {
|
|||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
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),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
InkWell(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
onTap: controller.loading ? null : controller.selectPhoto,
|
||||
child: CircleAvatar(
|
||||
radius: Avatar.defaultSize / 2,
|
||||
radius: Avatar.defaultSize,
|
||||
child: avatar == null
|
||||
? const Icon(Icons.camera_alt_outlined)
|
||||
? const Icon(Icons.add_a_photo_outlined)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
child: Image.memory(
|
||||
|
|
@ -53,9 +41,11 @@ class NewSpaceView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
const SizedBox(height: 32),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: controller.nameController,
|
||||
autocorrect: false,
|
||||
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),
|
||||
SwitchListTile.adaptive(
|
||||
title: Text(L10n.of(context)!.spaceIsPublic),
|
||||
value: controller.publicGroup,
|
||||
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: const EdgeInsets.all(16.0),
|
||||
child: SizedBox(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue