mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
change: Minor design improvements
This commit is contained in:
parent
c058d39cbb
commit
4e441d8861
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
class DefaultAppBarSearchField extends StatefulWidget {
|
||||
final TextEditingController searchController;
|
||||
final void Function(String) onChanged;
|
||||
final void Function(String) onSubmit;
|
||||
final Widget suffix;
|
||||
final bool autofocus;
|
||||
final String prefixText;
|
||||
@ -15,6 +16,7 @@ class DefaultAppBarSearchField extends StatefulWidget {
|
||||
Key key,
|
||||
this.searchController,
|
||||
this.onChanged,
|
||||
this.onSubmit,
|
||||
this.suffix,
|
||||
this.autofocus = false,
|
||||
this.prefixText,
|
||||
@ -75,6 +77,7 @@ class DefaultAppBarSearchFieldState extends State<DefaultAppBarSearchField> {
|
||||
onChanged: widget.onChanged,
|
||||
focusNode: _focusNode,
|
||||
readOnly: widget.readOnly,
|
||||
onSubmitted: widget.onSubmit,
|
||||
decoration: InputDecoration(
|
||||
prefixText: widget.prefixText,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
|
@ -87,6 +87,11 @@
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"noPublicRoomsFound": "No public rooms found...",
|
||||
"@noPublicRoomsFound": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"areYouSureYouWantToLogout": "Are you sure you want to log out?",
|
||||
"@areYouSureYouWantToLogout": {
|
||||
"type": "text",
|
||||
|
@ -17,28 +17,12 @@ class _ArchiveState extends State<Archive> {
|
||||
return await Matrix.of(context).client.archive;
|
||||
}
|
||||
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
bool _scrolledToTop = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_scrollController.addListener(() async {
|
||||
if (_scrollController.position.pixels > 0 && _scrolledToTop) {
|
||||
setState(() => _scrolledToTop = false);
|
||||
} else if (_scrollController.position.pixels == 0 && !_scrolledToTop) {
|
||||
setState(() => _scrolledToTop = true);
|
||||
}
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: BackButton(),
|
||||
title: Text(L10n.of(context).archive),
|
||||
elevation: _scrolledToTop ? 0 : null,
|
||||
),
|
||||
body: FutureBuilder<List<Room>>(
|
||||
future: getArchive(context),
|
||||
@ -48,7 +32,6 @@ class _ArchiveState extends State<Archive> {
|
||||
} else {
|
||||
archive = snapshot.data;
|
||||
return ListView.builder(
|
||||
controller: _scrollController,
|
||||
itemCount: archive.length,
|
||||
itemBuilder: (BuildContext context, int i) => ChatListItem(
|
||||
archive[i],
|
||||
|
@ -213,14 +213,16 @@ class _ChatListState extends State<ChatList> {
|
||||
size: 80,
|
||||
color: Colors.grey,
|
||||
),
|
||||
Text(
|
||||
searchMode
|
||||
? L10n.of(context).noRoomsFound
|
||||
: L10n.of(context).startYourFirstChat,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
Center(
|
||||
child: Text(
|
||||
searchMode
|
||||
? L10n.of(context).noRoomsFound
|
||||
: L10n.of(context).startYourFirstChat,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -5,6 +5,7 @@ import 'package:fluffychat/components/avatar.dart';
|
||||
import 'package:fluffychat/components/default_app_bar_search_field.dart';
|
||||
import 'package:fluffychat/components/list_items/contact_list_tile.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
import 'package:fluffychat/utils/fluffy_share.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../utils/client_presence_extension.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
@ -83,13 +84,41 @@ class _ContactListState extends State<ContactList> {
|
||||
.contains(_searchQuery.toLowerCase()))
|
||||
.toList();
|
||||
if (contactList.isEmpty) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'No contacts found...',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(height: 32),
|
||||
Icon(
|
||||
Icons.people_outlined,
|
||||
size: 80,
|
||||
color: Colors.grey,
|
||||
),
|
||||
RaisedButton(
|
||||
elevation: 7,
|
||||
color: Theme.of(context).primaryColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.share_outlined, color: Colors.white),
|
||||
SizedBox(width: 16),
|
||||
Text(
|
||||
L10n.of(context).inviteContact,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () => FluffyShare.share(
|
||||
L10n.of(context).inviteText(
|
||||
Matrix.of(context).client.userID,
|
||||
'https://matrix.to/#/${Matrix.of(context).client.userID}'),
|
||||
context),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
|
@ -173,11 +173,26 @@ class _DiscoverState extends State<Discover> {
|
||||
}
|
||||
final publicRoomsResponse = snapshot.data;
|
||||
if (publicRoomsResponse.chunk.isEmpty) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'No public groups found...',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 32),
|
||||
Icon(
|
||||
Icons.search_outlined,
|
||||
size: 80,
|
||||
color: Colors.grey,
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
L10n.of(context).noPublicRoomsFound,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return GridView.builder(
|
||||
|
@ -405,6 +405,11 @@ class _SettingsState extends State<Settings> {
|
||||
AdaptivePageLayout.of(context).pushNamed('/settings/emotes'),
|
||||
trailing: Icon(Icons.insert_emoticon_outlined),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context).archive),
|
||||
onTap: () => AdaptivePageLayout.of(context).pushNamed('/archive'),
|
||||
trailing: Icon(Icons.archive_outlined),
|
||||
),
|
||||
Divider(thickness: 1),
|
||||
ListTile(
|
||||
title: Text(
|
||||
|
@ -129,6 +129,7 @@ class _HomeserverPickerState extends State<HomeserverPicker> {
|
||||
padding: padding,
|
||||
onChanged: (s) => _domain = s,
|
||||
readOnly: !AppConfig.allowOtherHomeservers,
|
||||
onSubmit: (_) => _checkHomeserverAction(context),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user