Add ability to pin channels in "Following" tab (#395)
* add pinned channels list global config setting * add ability to pin streams * ensure that all pinned streams are fetched * rename * tweak padding * fix typo
This commit is contained in:
parent
0d503935df
commit
3a4cd449f7
11 changed files with 380 additions and 81 deletions
|
|
@ -1,20 +1,26 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:frosty/screens/settings/stores/auth_store.dart';
|
||||
import 'package:frosty/screens/settings/stores/settings_store.dart';
|
||||
import 'package:frosty/widgets/app_bar.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class BlockReportModal extends StatelessWidget {
|
||||
class UserActionsModal extends StatelessWidget {
|
||||
final AuthStore authStore;
|
||||
final String name;
|
||||
final String userLogin;
|
||||
final String userId;
|
||||
final bool showPinOption;
|
||||
final bool? isPinned;
|
||||
|
||||
const BlockReportModal({
|
||||
const UserActionsModal({
|
||||
super.key,
|
||||
required this.authStore,
|
||||
required this.name,
|
||||
required this.userLogin,
|
||||
required this.userId,
|
||||
this.showPinOption = false,
|
||||
this.isPinned,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -23,6 +29,26 @@ class BlockReportModal extends StatelessWidget {
|
|||
primary: false,
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
if (showPinOption)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.push_pin_outlined),
|
||||
title: Text('${isPinned == true ? 'Unpin' : 'Pin'} $name'),
|
||||
onTap: () {
|
||||
if (isPinned == true) {
|
||||
context.read<SettingsStore>().pinnedChannelIds = [
|
||||
...context.read<SettingsStore>().pinnedChannelIds
|
||||
..remove(userId),
|
||||
];
|
||||
} else {
|
||||
context.read<SettingsStore>().pinnedChannelIds = [
|
||||
...context.read<SettingsStore>().pinnedChannelIds,
|
||||
userId,
|
||||
];
|
||||
}
|
||||
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
if (authStore.isLoggedIn)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.block_rounded),
|
||||
Loading…
Add table
Add a link
Reference in a new issue