Skip to content

Commit

Permalink
Merge branch 'main' into cover_store_notify
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Nov 13, 2024
2 parents 6dbb887 + 5b35fe3 commit 4b6fb99
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 68 deletions.
5 changes: 4 additions & 1 deletion lib/common/view/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ List<Widget> space({
children
.expand(
(item) sync* {
yield SizedBox(width: widthGap);
yield SizedBox(
width: widthGap,
height: heightGap,
);
yield item;
},
)
Expand Down
130 changes: 63 additions & 67 deletions lib/settings/view/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -588,78 +588,74 @@ class _ExposeOnlineSection extends StatelessWidget with WatchItMixin {
subtitle: Column(
children: [
Text(l10n.exposeToLastfmSubTitle),
if (lastFmEnabled)
Form(
key: formkey,
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: TextFormField(
controller: lastFmApiKeyController,
decoration: InputDecoration(
hintText: l10n.lastfmApiKey,
),
validator: (value) {
if (value == null || value.isEmpty) {
return l10n.lastfmApiKeyEmpty;
}
return null;
},
onFieldSubmitted: (value) async {
if (formkey.currentState!.validate()) {
di<SettingsModel>().setLastFmApiKey(value);
}
},
),
],
),
trailing: CommonSwitch(
value: lastFmEnabled,
onChanged: (v) {
di<SettingsModel>().setEnableLastFmScrobbling(v);
},
),
),
if (lastFmEnabled) ...[
Padding(
padding: const EdgeInsets.all(8),
child: Form(
key: formkey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: space(
heightGap: 10,
children: [
TextFormField(
controller: lastFmApiKeyController,
decoration: InputDecoration(
hintText: l10n.lastfmApiKey,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: TextFormField(
controller: lastFmSecretController,
decoration: InputDecoration(
hintText: l10n.lastfmSecret,
),
validator: (value) {
if (value == null || value.isEmpty) {
return l10n.lastfmSecretEmpty;
}
return null;
},
onFieldSubmitted: (value) async {
if (formkey.currentState!.validate()) {
di<SettingsModel>().setLastFmSecret(value);
}
},
),
validator: (value) {
if (value == null || value.isEmpty) {
return l10n.lastfmApiKeyEmpty;
}
return null;
},
onFieldSubmitted: (value) async {
if (formkey.currentState!.validate()) {
di<SettingsModel>().setLastFmApiKey(value);
}
},
),
TextFormField(
controller: lastFmSecretController,
decoration: InputDecoration(
hintText: l10n.lastfmSecret,
),
],
),
validator: (value) {
if (value == null || value.isEmpty) {
return l10n.lastfmSecretEmpty;
}
return null;
},
onFieldSubmitted: (value) async {
if (formkey.currentState!.validate()) {
di<SettingsModel>().setLastFmSecret(value);
}
},
),
ImportantButton(
onPressed: () {
if (lastFmApiKeyController.text.isNotEmpty &&
lastFmSecretController.text.isNotEmpty) {
di<AppModel>().setLastFmAuth();
}
},
child: Text(l10n.save),
),
],
),
],
),
trailing: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CommonSwitch(
value: lastFmEnabled,
onChanged: (v) {
di<SettingsModel>().setEnableLastFmScrobbling(v);
},
),
if (lastFmEnabled)
ImportantButton(
onPressed: () {
if (lastFmApiKeyController.text.isNotEmpty &&
lastFmSecretController.text.isNotEmpty) {
di<AppModel>().setLastFmAuth();
}
},
child: Text(l10n.save),
),
],
),
),
),
],
],
),
);
Expand Down

0 comments on commit 4b6fb99

Please sign in to comment.