Fix settings screen (backend API changes)

pull/149/head
James Mills 4 days ago
parent 1b31d43ba2
commit c869cb4dff
Signed by untrusted user who does not match committer: prologic
GPG Key ID: AC4C014F1440EBD6
  1. 3
      lib/models.dart
  2. 2
      lib/models.g.dart
  3. 12
      lib/screens/settings.dart

@ -37,15 +37,12 @@ class User {
final String? username;
@JsonKey(name: 'Tagline')
final String? tagline;
@JsonKey(name: 'IsFollowersPubliclyVisible')
final bool? isFollowersPubliclyVisible;
@JsonKey(name: 'IsFollowingPubliclyVisible')
final bool? isFollowingPubliclyVisible;
User(
this.username,
this.tagline,
this.isFollowersPubliclyVisible,
this.isFollowingPubliclyVisible,
);

@ -25,14 +25,12 @@ Map<String, dynamic> _$AppUserToJson(AppUser instance) => <String, dynamic>{
User _$UserFromJson(Map<String, dynamic> json) => User(
json['Username'] as String?,
json['Tagline'] as String?,
json['IsFollowersPubliclyVisible'] as bool?,
json['IsFollowingPubliclyVisible'] as bool?,
);
Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
'Username': instance.username,
'Tagline': instance.tagline,
'IsFollowersPubliclyVisible': instance.isFollowersPubliclyVisible,
'IsFollowingPubliclyVisible': instance.isFollowingPubliclyVisible,
};

@ -59,7 +59,6 @@ class _SettingsState extends State<Settings> {
return SettingsBody(
tagline: user.tagline,
imageURL: context.watch<AppUser>().twter!.avatar.toString(),
isFollowersPubliclyVisible: user.isFollowersPubliclyVisible,
isFollowingPubliclyVisible: user.isFollowingPubliclyVisible,
);
}
@ -79,8 +78,8 @@ class SettingsBody extends StatefulWidget {
Key? key,
required this.tagline,
required this.imageURL,
required this.isFollowersPubliclyVisible,
required this.isFollowingPubliclyVisible,
this.isFollowersPubliclyVisible,
}) : super(key: key);
@override
_SettingsBodyState createState() => _SettingsBodyState();
@ -213,15 +212,6 @@ class _SettingsBodyState extends State<SettingsBody> {
),
SizedBox(height: 16),
Text('Privacy Settings', style: Theme.of(context).textTheme.subtitle1),
SwitchListTile(
title: Text('Followers are public'),
value: _isFollowersPubliclyVisible!,
onChanged: (value) {
setState(() {
_isFollowersPubliclyVisible = value;
});
},
),
SwitchListTile(
title: Text('Followings are public'),
value: _isFollowingPubliclyVisible!,

Loading…
Cancel
Save