design: Use IconButton instead of listTile for first story

This commit is contained in:
Christian Pauly 2022-02-03 08:52:22 +01:00
parent 0a909dcfb9
commit 787bdbcba9
2 changed files with 61 additions and 50 deletions

View File

@ -14,6 +14,7 @@ import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
import 'package:fluffychat/pages/chat_list/client_chooser_button.dart';
import 'package:fluffychat/pages/chat_list/spaces_bottom_bar.dart';
import 'package:fluffychat/pages/chat_list/stories_header.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
import 'package:fluffychat/widgets/connection_status_header.dart';
import '../../utils/stream_extension.dart';
import '../../widgets/matrix.dart';
@ -99,6 +100,14 @@ class ChatListView extends StatelessWidget {
onPressed: () =>
VRouter.of(context).to('/search'),
),
if (selectMode == SelectMode.normal &&
Matrix.of(context).client.storiesRooms.isEmpty)
IconButton(
icon: const Icon(Icons.camera_alt_outlined),
tooltip: L10n.of(context)!.addToStory,
onPressed: () =>
VRouter.of(context).to('/stories/create'),
),
PopupMenuButton<PopupMenuAction>(
onSelected: controller.onPopupMenuSelect,
itemBuilder: (_) => [

View File

@ -87,15 +87,13 @@ class StoriesHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final client = Matrix.of(context).client;
return StreamBuilder<Object>(
return StreamBuilder(
stream: Matrix.of(context).onShareContentChanged.stream,
builder: (context, _) => StreamBuilder<Object>(
stream: client.onSync.stream
.where((syncUpdate) => syncUpdate.hasRoomUpdate),
builder: (context, snapshot) {
if (client.storiesRooms.isEmpty && client.contacts.isEmpty) {
return Container();
}
if (client.storiesRooms.isEmpty ||
Matrix.of(context).shareContent != null) {
if (Matrix.of(context).shareContent != null) {
return ListTile(
leading: CircleAvatar(
radius: Avatar.defaultSize / 2,
@ -107,6 +105,9 @@ class StoriesHeader extends StatelessWidget {
onTap: () => _addToStoryAction(context),
);
}
if (client.storiesRooms.isEmpty) {
return Container();
}
return SizedBox(
height: 98,
child: ListView(
@ -141,7 +142,8 @@ class StoriesHeader extends StatelessWidget {
],
),
);
});
}),
);
}
}