Cleaner 'add app' page

This commit is contained in:
Imran Remtulla
2024-01-19 20:35:44 -05:00
parent 29a76ac8e6
commit 4ab4f58f65

View File

@@ -496,36 +496,59 @@ class AddAppPageState extends State<AddAppPage> {
], ],
); );
Widget getSourcesListWidget() => Column( Widget getSourcesListWidget() => Padding(
crossAxisAlignment: CrossAxisAlignment.center, padding: const EdgeInsets.all(16),
mainAxisAlignment: MainAxisAlignment.center, child: Row(
children: [ children: [
Text( GestureDetector(
tr('supportedSources'), onTap: () {
style: const TextStyle(fontWeight: FontWeight.bold), showDialog(
), context: context,
const SizedBox( builder: (context) {
height: 16, return GeneratedFormModal(
), title: tr('supportedSources'),
...sourceProvider.sources.map((e) => GestureDetector( items: const [],
onTap: e.hosts.isNotEmpty additionalWidgets: [
? () { ...sourceProvider.sources.map(
launchUrlString('https://${e.hosts[0]}', (e) => Padding(
mode: LaunchMode.externalApplication); padding: EdgeInsets.symmetric(vertical: 4),
} child: GestureDetector(
: null, onTap: e.hosts.isNotEmpty
? () {
launchUrlString(
'https://${e.hosts[0]}',
mode: LaunchMode
.externalApplication);
}
: null,
child: Text(
'${e.name}${e.enforceTrackOnly ? ' ${tr('trackOnlyInBrackets')}' : ''}${e.canSearch ? ' ${tr('searchableInBrackets')}' : ''}',
style: TextStyle(
decoration: e.hosts.isNotEmpty
? TextDecoration.underline
: TextDecoration.none),
))),
)
],
);
},
);
},
child: Text( child: Text(
'${e.name}${e.enforceTrackOnly ? ' ${tr('trackOnlyInBrackets')}' : ''}${e.canSearch ? ' ${tr('searchableInBrackets')}' : ''}', tr('supportedSources'),
style: TextStyle( style: const TextStyle(
decoration: e.hosts.isNotEmpty fontWeight: FontWeight.bold,
? TextDecoration.underline decoration: TextDecoration.underline,
: TextDecoration.none,
fontStyle: FontStyle.italic), fontStyle: FontStyle.italic),
))) ))
]); ],
),
);
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: Theme.of(context).colorScheme.surface,
bottomNavigationBar:
pickedSource == null ? getSourcesListWidget() : null,
body: CustomScrollView(shrinkWrap: true, slivers: <Widget>[ body: CustomScrollView(shrinkWrap: true, slivers: <Widget>[
CustomAppBar(title: tr('addApp')), CustomAppBar(title: tr('addApp')),
SliverToBoxAdapter( SliverToBoxAdapter(
@@ -557,18 +580,7 @@ class AddAppPageState extends State<AddAppPage> {
: const SizedBox(); : const SizedBox();
}, },
future: pickedSource?.getSourceNote()), future: pickedSource?.getSourceNote()),
SizedBox(
height: pickedSource != null ? 16 : 96,
),
if (pickedSource != null) getAdditionalOptsCol(), if (pickedSource != null) getAdditionalOptsCol(),
if (pickedSource == null)
const Divider(
height: 48,
),
if (pickedSource == null) getSourcesListWidget(),
SizedBox(
height: pickedSource != null ? 8 : 2,
),
])), ])),
) )
])); ]));