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