1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +00:00

Fix refresh when changing account image

This commit is contained in:
Pierre HUBERT 2021-04-23 13:48:33 +02:00
parent 46f9c917b5
commit 522ef8e471
2 changed files with 16 additions and 3 deletions

View File

@ -40,11 +40,19 @@ class _TourRouteState extends State<TourRoute> {
await UsersHelper().getSingleWithThrow(userID(), forceDownload: true); await UsersHelper().getSingleWithThrow(userID(), forceDownload: true);
} }
void setStateKeepCurrentIndex(BuildContext cxt) async {
_defaultIndex = DefaultTabController.of(cxt).index;
await key.currentState.refresh();
}
List<Widget> get _list => [ List<Widget> get _list => [
FirstTourPane(), FirstTourPane(),
// Account image // Account image
AccountImageTourPane(user: currUser), AccountImageTourPane(
user: currUser,
onUpdated: setStateKeepCurrentIndex,
),
// Notifications // Notifications
PresentationPane( PresentationPane(

View File

@ -6,8 +6,12 @@ import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AccountImageTourPane extends PresentationPane { class AccountImageTourPane extends PresentationPane {
AccountImageTourPane({@required User user}) final Function(BuildContext) onUpdated;
: super(
AccountImageTourPane({
@required User user,
@required this.onUpdated,
}) : super(
iconWidget: AccountImageWidget(user: user, width: 50), iconWidget: AccountImageWidget(user: user, width: 50),
title: tr("Account image"), title: tr("Account image"),
text: tr( text: tr(
@ -15,5 +19,6 @@ class AccountImageTourPane extends PresentationPane {
actionTitle: tr("Upload an account image"), actionTitle: tr("Upload an account image"),
onActionTap: (ctx) async { onActionTap: (ctx) async {
await uploadNewAccountImage(ctx); await uploadNewAccountImage(ctx);
onUpdated(ctx);
}); });
} }