Version 0.10.0

This commit is contained in:
Christian Pauly 2020-03-29 12:06:25 +02:00
commit 67eedc4a77
16 changed files with 313 additions and 126 deletions

View file

@ -19,7 +19,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:image_picker/image_picker.dart';
import 'package:toast/toast.dart';
import 'package:pedantic/pedantic.dart';
import 'chat_list.dart';
@ -178,7 +177,14 @@ class _ChatState extends State<_Chat> {
void sendFileAction(BuildContext context) async {
if (kIsWeb) {
return Toast.show(I18n.of(context).notSupportedInWeb, context);
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).notSupportedInWeb,
),
),
);
return;
}
File file = await FilePicker.getFile();
if (file == null) return;
@ -191,7 +197,14 @@ class _ChatState extends State<_Chat> {
void sendImageAction(BuildContext context) async {
if (kIsWeb) {
return Toast.show(I18n.of(context).notSupportedInWeb, context);
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).notSupportedInWeb,
),
),
);
return;
}
File file = await ImagePicker.pickImage(
source: ImageSource.gallery,
@ -208,7 +221,14 @@ class _ChatState extends State<_Chat> {
void openCameraAction(BuildContext context) async {
if (kIsWeb) {
return Toast.show(I18n.of(context).notSupportedInWeb, context);
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).notSupportedInWeb,
),
),
);
return;
}
File file = await ImagePicker.pickImage(
source: ImageSource.camera,

View file

@ -19,7 +19,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:link_text/link_text.dart';
import 'package:toast/toast.dart';
class ChatDetails extends StatefulWidget {
final Room room;
@ -44,10 +43,12 @@ class _ChatDetailsState extends State<ChatDetails> {
widget.room.setName(displayname),
);
if (success != false) {
Toast.show(
I18n.of(context).displaynameHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).displaynameHasBeenChanged,
),
),
);
}
}
@ -109,10 +110,12 @@ class _ChatDetailsState extends State<ChatDetails> {
widget.room.setDescription(displayname),
);
if (success != false) {
Toast.show(
I18n.of(context).groupDescriptionHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).groupDescriptionHasBeenChanged,
),
),
);
}
}
@ -134,10 +137,12 @@ class _ChatDetailsState extends State<ChatDetails> {
),
);
if (success != false) {
Toast.show(
I18n.of(context).avatarHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).avatarHasBeenChanged,
),
),
);
}
}
@ -195,8 +200,13 @@ class _ChatDetailsState extends State<ChatDetails> {
Clipboard.setData(
ClipboardData(text: widget.room.canonicalAlias),
);
Toast.show(I18n.of(context).copiedToClipboard, context,
duration: 5);
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).copiedToClipboard,
),
),
);
},
),
ChatSettingsPopupMenu(widget.room, false)

View file

@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:toast/toast.dart';
import 'package:uni_links/uni_links.dart';
import '../components/dialogs/simple_dialogs.dart';
@ -125,10 +124,13 @@ class _ChatListState extends State<ChatList> {
debugPrint("initUniLinks failed during platform exception");
}
},
onError: (error) => Toast.show(
I18n.of(context).oopsSomethingWentWrong + " " + error.toString(),
context,
duration: 5),
onError: (error) => Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).oopsSomethingWentWrong + " " + error.toString(),
),
),
),
);
}

View file

@ -6,7 +6,6 @@ import 'package:fluffychat/components/avatar.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
import 'package:toast/toast.dart';
import 'chat_list.dart';
@ -52,10 +51,12 @@ class _InvitationSelectionState extends State<InvitationSelection> {
widget.room.invite(id),
);
if (success != false) {
Toast.show(
I18n.of(context).contactHasBeenInvitedToTheGroup,
context,
duration: Toast.LENGTH_LONG,
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).contactHasBeenInvitedToTheGroup,
),
),
);
}
}

View file

@ -5,7 +5,6 @@ import 'package:fluffychat/components/settings_themes.dart';
import 'package:fluffychat/views/settings_devices.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:toast/toast.dart';
import 'package:url_launcher/url_launcher.dart';
import 'app_info.dart';
@ -86,11 +85,6 @@ class _SettingsState extends State<Settings> {
),
);
if (success != false) {
Toast.show(
I18n.of(context).avatarHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
);
setState(() {
profileFuture = null;
profile = null;
@ -194,25 +188,19 @@ class _SettingsState extends State<Settings> {
),
),
ListTile(
leading: Icon(Icons.help),
trailing: Icon(Icons.help),
title: Text(I18n.of(context).help),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/issues"),
),
ListTile(
leading: Icon(Icons.list),
title: Text(I18n.of(context).changelog),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/blob/master/CHANGELOG.md"),
),
ListTile(
leading: Icon(Icons.link),
trailing: Icon(Icons.link),
title: Text(I18n.of(context).license),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/raw/master/LICENSE"),
),
ListTile(
leading: Icon(Icons.code),
trailing: Icon(Icons.code),
title: Text(I18n.of(context).sourceCode),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter"),

View file

@ -87,6 +87,7 @@ class DevicesSettingsState extends State<DevicesSettings> {
UserDevice thisDevice =
devices.firstWhere(isOwnDevice, orElse: () => null);
devices.removeWhere(isOwnDevice);
devices.sort((a, b) => b.lastSeenTs.compareTo(a.lastSeenTs));
return Column(
children: <Widget>[
if (thisDevice != null)
@ -159,9 +160,15 @@ class UserDeviceListItem extends StatelessWidget {
contentPadding: EdgeInsets.all(16.0),
title: Row(
children: <Widget>[
Text((userDevice.displayName?.isNotEmpty ?? false)
? userDevice.displayName
: I18n.of(context).unknownDevice),
Expanded(
child: Text(
(userDevice.displayName?.isNotEmpty ?? false)
? userDevice.displayName
: I18n.of(context).unknownDevice,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Spacer(),
Text(userDevice.lastSeenTs.localizedTimeShort(context)),
],

View file

@ -7,7 +7,6 @@ import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/auth_web_view.dart';
import 'package:flutter/material.dart';
import 'package:toast/toast.dart';
import 'chat_list.dart';
@ -96,7 +95,13 @@ class _SignUpPasswordState extends State<SignUpPassword> {
try {
await matrix.client.setDisplayname(widget.displayname);
} catch (exception) {
Toast.show(I18n.of(context).couldNotSetDisplayname, context, duration: 5);
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).couldNotSetDisplayname,
),
),
);
}
if (widget.avatar != null) {
try {
@ -107,7 +112,13 @@ class _SignUpPasswordState extends State<SignUpPassword> {
),
);
} catch (exception) {
Toast.show(I18n.of(context).couldNotSetAvatar, context, duration: 5);
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
I18n.of(context).couldNotSetAvatar,
),
),
);
}
}
await Navigator.of(context).pushAndRemoveUntil(