invalidates cachednetworkimage when new profile photo is uploaded
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@@ -47,7 +48,6 @@ class HomePageAppBar extends ConsumerWidget with PreferredSizeWidget {
|
||||
);
|
||||
} else {
|
||||
String endpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||
var dummy = Random().nextInt(1024);
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
@@ -57,8 +57,8 @@ class HomePageAppBar extends ConsumerWidget with PreferredSizeWidget {
|
||||
radius: 18,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).primaryColor.withOpacity(0.1),
|
||||
backgroundImage: NetworkImage(
|
||||
'$endpoint/user/profile-image/${authState.userId}?d=${dummy++}',
|
||||
backgroundImage: CachedNetworkImageProvider(
|
||||
'$endpoint/user/profile-image/${authState.userId}',
|
||||
),
|
||||
radius: 17,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user