Update Provider to Prevent Null Safety Crashes on Updated Flutter
This commit is contained in:
parent
bf6440dcfd
commit
1ff3b06fb3
|
@ -85,7 +85,7 @@ class _ContactsViewState extends State<ContactsView> {
|
||||||
|
|
||||||
Widget _buildContactList() {
|
Widget _buildContactList() {
|
||||||
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
|
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
|
||||||
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.onion), value: contact, builder: (_, __) => ContactRow());
|
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.profileOnion+""+contact.onion), value: contact, builder: (_, __) => ContactRow());
|
||||||
});
|
});
|
||||||
final divided = ListTile.divideTiles(
|
final divided = ListTile.divideTiles(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
@ -140,11 +140,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
),
|
),
|
||||||
onPressed: _sendMessage,
|
onPressed: _sendMessage,
|
||||||
))),
|
))),
|
||||||
SizedBox(
|
])
|
||||||
width: 86,
|
|
||||||
height: 40,
|
|
||||||
child: IconButton(icon: Icon(Icons.insert_invitation, size: 12, color: Provider.of<Settings>(context).theme.mainTextColor()), onPressed: () => _modalSendInvitation(context))),
|
|
||||||
])
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -88,15 +88,17 @@ class _ContactRowState extends State<ContactRow> {
|
||||||
|
|
||||||
void _pushMessageView(String handle) {
|
void _pushMessageView(String handle) {
|
||||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle).unreadMessages = 0;
|
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle).unreadMessages = 0;
|
||||||
|
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute<void>(
|
MaterialPageRoute<void>(
|
||||||
builder: (BuildContext builderContext) {
|
builder: (BuildContext builderContext) {
|
||||||
|
var profile = Provider.of<FlwtchState>(builderContext, listen: false).profs.getProfile(profileOnion);
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context)),
|
ChangeNotifierProvider.value(value: profile),
|
||||||
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context).contactList.getContact(handle)),
|
ChangeNotifierProvider.value(value: profile.contactList.getContact(handle)),
|
||||||
],
|
],
|
||||||
child: MessageView(),
|
builder:(context, child) => MessageView(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -14,7 +14,7 @@ packages:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.6.0"
|
version: "2.6.1"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in New Issue