mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-12 14:09:12 +08:00

This is only shows if there are subFolders with '.md' files. This feature is super important for me as it allows me to finally dogfood this app and use it This patch just adds the screen, but the subFolder selection currently doesn't do anything.
77 lines
1.8 KiB
Dart
77 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'githostsetup_button.dart';
|
|
|
|
class GitHostSetupFolderPage extends StatelessWidget {
|
|
final List<String> folders;
|
|
final Function rootFolderSelected;
|
|
final Function subFolderSelected;
|
|
|
|
GitHostSetupFolderPage({
|
|
@required this.folders,
|
|
@required this.rootFolderSelected,
|
|
@required this.subFolderSelected,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var columns = Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Text(
|
|
'Would you like to store your journal entries in an existing folder?',
|
|
style: Theme.of(context).textTheme.title,
|
|
),
|
|
SizedBox(height: 32.0),
|
|
FolderListWidget(
|
|
folders: folders,
|
|
onSelected: subFolderSelected,
|
|
),
|
|
SizedBox(height: 16.0),
|
|
GitHostSetupButton(
|
|
text: "Ignore",
|
|
onPressed: rootFolderSelected,
|
|
),
|
|
],
|
|
);
|
|
|
|
return Center(
|
|
child: SingleChildScrollView(
|
|
child: columns,
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
// FIXME: This needs to be made much much prettier!
|
|
class FolderListWidget extends StatelessWidget {
|
|
final List<String> folders;
|
|
final Function onSelected;
|
|
|
|
FolderListWidget({
|
|
@required this.folders,
|
|
@required this.onSelected,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var buttons = <Widget>[];
|
|
for (var folderName in folders) {
|
|
var button = GitHostSetupButton(
|
|
text: folderName,
|
|
onPressed: () {
|
|
onSelected(folderName);
|
|
},
|
|
);
|
|
buttons.add(button);
|
|
}
|
|
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: buttons,
|
|
);
|
|
}
|
|
}
|