change: Chat backup dialog as a banner

This commit is contained in:
Krille Fear 2021-11-19 09:12:47 +01:00
commit ba3cf3a91f
4 changed files with 50 additions and 29 deletions

View file

@ -79,13 +79,13 @@ class ChatListController extends State<ChatList> {
final selectedRoomIds = <String>{};
bool crossSigningCached;
bool hideChatBackupBanner = false;
void hideChatBackupBannerAction() =>
setState(() => hideChatBackupBanner = true);
bool showChatBackupBanner = false;
void firstRunBootstrapAction() async {
hideChatBackupBannerAction();
setState(() {
showChatBackupBanner = false;
});
await BootstrapDialog(
client: Matrix.of(context).client,
).show(context);
@ -181,7 +181,9 @@ class ChatListController extends State<ChatList> {
crossSigning == false;
final isUnknownSession = Matrix.of(context).client.isUnknownSession;
if (needsBootstrap || isUnknownSession) {
firstRunBootstrapAction();
setState(() {
showChatBackupBanner = true;
});
}
}

View file

@ -182,6 +182,27 @@ class ChatListView extends StatelessWidget {
),
body: Column(children: [
const ConnectionStatusHeader(),
AnimatedContainer(
height: controller.showChatBackupBanner ? 54 : 0,
duration: const Duration(milliseconds: 300),
clipBehavior: Clip.hardEdge,
curve: Curves.bounceInOut,
decoration: const BoxDecoration(),
child: MaterialBanner(
leading: Image.asset(
'assets/backup.png',
fit: BoxFit.contain,
width: 44,
),
content: Text(L10n.of(context).setupChatBackupNow),
actions: [
TextButton(
onPressed: controller.firstRunBootstrapAction,
child: Text(L10n.of(context).start),
),
],
),
),
Expanded(child: _ChatListViewBody(controller)),
]),
floatingActionButton: selectMode == SelectMode.normal