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,54 +31,35 @@ 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,
|
||||
child: avatar == null
|
||||
? const Icon(Icons.camera_alt_outlined)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
child: Image.memory(
|
||||
avatar,
|
||||
width: Avatar.defaultSize,
|
||||
height: Avatar.defaultSize,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: controller.nameController,
|
||||
autocorrect: false,
|
||||
readOnly: controller.loading,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.people_outlined),
|
||||
hintText: L10n.of(context)!.groupName,
|
||||
InkWell(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
onTap: controller.loading ? null : controller.selectPhoto,
|
||||
child: CircleAvatar(
|
||||
radius: Avatar.defaultSize,
|
||||
child: avatar == null
|
||||
? const Icon(Icons.add_a_photo_outlined)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
child: Image.memory(
|
||||
avatar,
|
||||
width: Avatar.defaultSize,
|
||||
height: Avatar.defaultSize,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 32),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: TextField(
|
||||
controller: controller.topicController,
|
||||
minLines: 4,
|
||||
maxLines: 4,
|
||||
maxLength: 255,
|
||||
autofocus: true,
|
||||
controller: controller.nameController,
|
||||
autocorrect: false,
|
||||
readOnly: controller.loading,
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.of(context)!.addChatDescription,
|
||||
prefixIcon: const Icon(Icons.people_outlined),
|
||||
hintText: L10n.of(context)!.groupName,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -22,65 +22,37 @@ 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,
|
||||
child: avatar == null
|
||||
? const Icon(Icons.camera_alt_outlined)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
child: Image.memory(
|
||||
avatar,
|
||||
width: Avatar.defaultSize,
|
||||
height: Avatar.defaultSize,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: controller.nameController,
|
||||
autocorrect: false,
|
||||
readOnly: controller.loading,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.people_outlined),
|
||||
hintText: L10n.of(context)!.spaceName,
|
||||
errorText: controller.nameError,
|
||||
InkWell(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
onTap: controller.loading ? null : controller.selectPhoto,
|
||||
child: CircleAvatar(
|
||||
radius: Avatar.defaultSize,
|
||||
child: avatar == null
|
||||
? const Icon(Icons.add_a_photo_outlined)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(90),
|
||||
child: Image.memory(
|
||||
avatar,
|
||||
width: Avatar.defaultSize,
|
||||
height: Avatar.defaultSize,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 32),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: TextField(
|
||||
controller: controller.topicController,
|
||||
minLines: 4,
|
||||
maxLines: 4,
|
||||
maxLength: 255,
|
||||
autofocus: true,
|
||||
controller: controller.nameController,
|
||||
autocorrect: false,
|
||||
readOnly: controller.loading,
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.of(context)!.addChatDescription,
|
||||
errorText: controller.topicError,
|
||||
prefixIcon: const Icon(Icons.people_outlined),
|
||||
hintText: L10n.of(context)!.spaceName,
|
||||
errorText: controller.nameError,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -90,6 +62,13 @@ class NewSpaceView extends StatelessWidget {
|
|||
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
Reference in a new issue