Krille/design improvements

This commit is contained in:
Christian Pauly 2020-06-24 07:42:28 +00:00
commit 2f143055ba
7 changed files with 160 additions and 165 deletions

View file

@ -43,15 +43,17 @@ class PresenceListItem extends StatelessWidget {
width: 80,
child: Column(
children: <Widget>[
SizedBox(height: 9),
SizedBox(height: 16),
Avatar(user.avatarUrl, user.calcDisplayname()),
Padding(
padding: const EdgeInsets.all(6.0),
padding: const EdgeInsets.only(left: 6.0, top: 6.0, right: 6.0),
child: Text(
user.calcDisplayname(),
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xFF555555),
fontSize: 13,
fontWeight: presence?.presence?.statusMsg == null
? null
: FontWeight.bold,

View file

@ -7,6 +7,6 @@ extension StringColor on String {
number += codeUnitAt(i);
}
number = (number % 10) * 25.5;
return HSLColor.fromAHSL(1, number, 1, 0.35).toColor();
return HSLColor.fromAHSL(1, number, 1, 0.66).toColor();
}
}

View file

@ -345,9 +345,7 @@ class _ChatState extends State<_Chat> {
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Theme.of(context).appBarTheme.color.withOpacity(0.95),
leading: selectMode
? IconButton(
icon: Icon(Icons.close),
@ -587,7 +585,7 @@ class _ChatState extends State<_Chat> {
Theme.of(context).backgroundColor.withOpacity(0.8),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: selectMode
? <Widget>[
@ -638,80 +636,88 @@ class _ChatState extends State<_Chat> {
]
: <Widget>[
if (inputText.isEmpty)
PopupMenuButton<String>(
icon: Icon(Icons.add),
onSelected: (String choice) async {
if (choice == 'file') {
sendFileAction(context);
} else if (choice == 'image') {
sendImageAction(context);
}
if (choice == 'camera') {
openCameraAction(context);
}
if (choice == 'voice') {
voiceMessageAction(context);
}
},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem<String>(
value: 'file',
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.green,
foregroundColor: Colors.white,
child: Icon(Icons.attachment),
),
title:
Text(L10n.of(context).sendFile),
contentPadding: EdgeInsets.all(0),
),
),
PopupMenuItem<String>(
value: 'image',
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.blue,
foregroundColor: Colors.white,
child: Icon(Icons.image),
),
title:
Text(L10n.of(context).sendImage),
contentPadding: EdgeInsets.all(0),
),
),
if (!kIsWeb)
Container(
height: 56,
alignment: Alignment.center,
child: PopupMenuButton<String>(
icon: Icon(Icons.add),
onSelected: (String choice) async {
if (choice == 'file') {
sendFileAction(context);
} else if (choice == 'image') {
sendImageAction(context);
}
if (choice == 'camera') {
openCameraAction(context);
}
if (choice == 'voice') {
voiceMessageAction(context);
}
},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem<String>(
value: 'camera',
value: 'file',
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.purple,
backgroundColor: Colors.green,
foregroundColor: Colors.white,
child: Icon(Icons.camera_alt),
child: Icon(Icons.attachment),
),
title: Text(
L10n.of(context).openCamera),
title:
Text(L10n.of(context).sendFile),
contentPadding: EdgeInsets.all(0),
),
),
if (!kIsWeb)
PopupMenuItem<String>(
value: 'voice',
value: 'image',
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.red,
backgroundColor: Colors.blue,
foregroundColor: Colors.white,
child: Icon(Icons.mic),
child: Icon(Icons.image),
),
title: Text(
L10n.of(context).voiceMessage),
L10n.of(context).sendImage),
contentPadding: EdgeInsets.all(0),
),
),
],
if (!kIsWeb)
PopupMenuItem<String>(
value: 'camera',
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.purple,
foregroundColor: Colors.white,
child: Icon(Icons.camera_alt),
),
title: Text(
L10n.of(context).openCamera),
contentPadding: EdgeInsets.all(0),
),
),
if (!kIsWeb)
PopupMenuItem<String>(
value: 'voice',
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.red,
foregroundColor: Colors.white,
child: Icon(Icons.mic),
),
title: Text(L10n.of(context)
.voiceMessage),
contentPadding: EdgeInsets.all(0),
),
),
],
),
),
EncryptionButton(room),
Container(
height: 56,
alignment: Alignment.center,
child: EncryptionButton(room),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
@ -733,6 +739,7 @@ class _ChatState extends State<_Chat> {
decoration: InputDecoration(
hintText:
L10n.of(context).writeAMessage,
hintMaxLines: 1,
border: InputBorder.none,
),
onChanged: (String text) {
@ -760,15 +767,23 @@ class _ChatState extends State<_Chat> {
),
),
if (!kIsWeb && inputText.isEmpty)
IconButton(
icon: Icon(Icons.mic),
onPressed: () =>
voiceMessageAction(context),
Container(
height: 56,
alignment: Alignment.center,
child: IconButton(
icon: Icon(Icons.mic),
onPressed: () =>
voiceMessageAction(context),
),
),
if (kIsWeb || inputText.isNotEmpty)
IconButton(
icon: Icon(Icons.send),
onPressed: () => send(),
Container(
height: 56,
alignment: Alignment.center,
child: IconButton(
icon: Icon(Icons.send),
onPressed: () => send(),
),
),
],
),

View file

@ -8,11 +8,8 @@ import 'package:fluffychat/components/list_items/presence_list_item.dart';
import 'package:fluffychat/components/list_items/public_room_list_item.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:share/share.dart';
import '../components/theme_switcher.dart';
import '../components/adaptive_page_layout.dart';
import '../components/list_items/chat_list_item.dart';
import '../components/matrix.dart';
@ -289,7 +286,7 @@ class _ChatListState extends State<ChatList> {
),
),
appBar: AppBar(
elevation: _scrolledToTop ? 0 : null,
//elevation: _scrolledToTop ? 0 : null,
leading: selectMode != SelectMode.share
? null
: IconButton(
@ -297,60 +294,19 @@ class _ChatListState extends State<ChatList> {
onPressed: () =>
Matrix.of(context).shareContent = null,
),
automaticallyImplyLeading: false,
titleSpacing: 0,
title: selectMode == SelectMode.share
? Text(L10n.of(context).share)
: Container(
height: 42,
margin: EdgeInsets.symmetric(horizontal: 8),
child: Material(
elevation: 5,
borderRadius: BorderRadius.circular(7),
child: Padding(
padding: EdgeInsets.all(8),
child: Row(
children: [
Builder(
builder: (context) => IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.menu),
onPressed: () =>
Scaffold.of(context).openDrawer(),
),
),
Expanded(
child: TextField(
autocorrect: false,
controller: searchController,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(9),
border: InputBorder.none,
hintText:
L10n.of(context).searchForAChat,
),
),
),
loadingPublicRooms
? Container(
alignment: Alignment.centerRight,
child: Container(
width: 20,
height: 20,
child:
CircularProgressIndicator(),
),
)
: IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.account_circle),
onPressed: () =>
Navigator.of(context).push(
AppRoute.defaultRoute(
context,
SettingsView())),
),
],
: Padding(
padding: EdgeInsets.all(8),
child: Expanded(
child: TextField(
autocorrect: false,
controller: searchController,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(9),
border: InputBorder.none,
hintText: L10n.of(context).searchForAChat,
),
),
),
@ -360,39 +316,14 @@ class _ChatListState extends State<ChatList> {
(AdaptivePageLayout.columnMode(context) ||
selectMode == SelectMode.share)
? null
: SpeedDial(
: FloatingActionButton(
child: Icon(Icons.add),
overlayColor: blackWhiteColor(context),
foregroundColor: Colors.white,
backgroundColor: Theme.of(context).primaryColor,
children: [
SpeedDialChild(
child: Icon(Icons.people_outline),
foregroundColor: Colors.white,
backgroundColor: Colors.blue,
label: L10n.of(context).createNewGroup,
labelStyle: TextStyle(
fontSize: 18.0, color: Colors.black),
onTap: () => Navigator.of(context)
.pushAndRemoveUntil(
AppRoute.defaultRoute(
context, NewGroupView()),
(r) => r.isFirst),
),
SpeedDialChild(
child: Icon(Icons.person_add),
foregroundColor: Colors.white,
backgroundColor: Colors.green,
label: L10n.of(context).newPrivateChat,
labelStyle: TextStyle(
fontSize: 18.0, color: Colors.black),
onTap: () => Navigator.of(context)
.pushAndRemoveUntil(
AppRoute.defaultRoute(
context, NewPrivateChatView()),
(r) => r.isFirst),
),
],
onPressed: () => Navigator.of(context)
.pushAndRemoveUntil(
AppRoute.defaultRoute(
context, NewPrivateChatView()),
(r) => r.isFirst),
),
body: StreamBuilder(
stream: Matrix.of(context).client.onSync.stream,