initial settings screen

master
EmaMaker 2021-09-18 19:51:58 +02:00
parent ce2cc563a6
commit 5ea4cd3bd8
3 changed files with 57 additions and 20 deletions

View File

@ -39,8 +39,7 @@ class MyListTileState extends State<MyListTile> {
debugPrint("Recreating cards");
return widget.selectMode
? Card(
child: CheckboxListTile(
? CheckboxListTile(
title: Text(basename(widget.file.path)),
checkColor: Colors.white,
value: isChecked,
@ -48,9 +47,8 @@ class MyListTileState extends State<MyListTile> {
setState(() {
isChecked = widget.selectMode && value!;
});
}))
: Card(
child: ListTile(
})
: ListTile(
title: Text(
basename(widget.file.path),
style: _biggerFont,
@ -61,7 +59,7 @@ class MyListTileState extends State<MyListTile> {
// onTap: _handleNote,
subtitle: _subtitle(widget.file),
trailing: btnListTileMore(context, widget.file),
));
);
}
DropdownButton btnListTileMore(BuildContext context, File f) {

View File

@ -2,10 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:notes_app/components/storage.dart';
import 'package:notes_app/screens/home/components/MyListTile.dart';
import 'package:notes_app/screens/note/note.dart';
import 'package:notes_app/screens/settings/settings.dart';
import 'package:path/path.dart';
import 'dart:io';
class MyHomePage extends StatefulWidget {
@ -125,17 +123,16 @@ class _MyHomePageState extends State<MyHomePage> {
enterSelectMode();
}
/* DROP DOWN MENUS*/
DropdownButton btnAppBarMoreSelect() {
return DropdownButton<String>(
icon: const Icon(Icons.more_vert, color: Colors.white),
onChanged: (String? newValue) {
switch (newValue) {
case "Delete":
keys.forEach((element) { element.currentState?.deleteFileFromSelect(); });
keys.forEach((element) {
element.currentState?.deleteFileFromSelect();
});
break;
case "Cancel":
exitSelectMode();
@ -163,7 +160,7 @@ class _MyHomePageState extends State<MyHomePage> {
break;
case "Settings":
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => Settings()));
context, MaterialPageRoute(builder: (context) => Settings(storage: widget.storage,)));
}
setState(() {});
},

View File

@ -1,7 +1,12 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:notes_app/components/storage.dart';
import 'package:notes_app/screens/home/home.dart';
class Settings extends StatefulWidget {
const Settings({Key? key}) : super(key: key);
const Settings({Key? key, required this.storage}) : super(key: key);
final CounterStorage storage;
@override
_SettingsState createState() => _SettingsState();
@ -10,7 +15,7 @@ class Settings extends StatefulWidget {
class _SettingsState extends State<Settings> {
@override
Widget build(BuildContext context) {
return new WillPopScope(
return WillPopScope(
child: Scaffold(
appBar: AppBar(
toolbarHeight: 55,
@ -22,21 +27,58 @@ class _SettingsState extends State<Settings> {
icon: new Icon(Icons.arrow_back),
onPressed: () => {
setState(() {
Navigator.pop(context);
_toPrevious();
})
},
),
),
body: ListView(),
body: ListView(padding: EdgeInsets.all(8), children: [
ListTile(
isThreeLine: false,
leading: Icon(Icons.sort),
title: Text("Sort By:"),
subtitle: Text("WIP"),
),
ListTile(
leading: Icon(Icons.train),
title: Text("Theme"),
subtitle: Text("WIP"),
),
ListTile(
leading: Icon(Icons.info_outline_rounded),
title: Text("About"),
subtitle: Text("Info about this app"),
onTap: () => _aboutDialog(context),
),
]),
),
onWillPop: () async {
setState(() {
Navigator.pop(context);
});
_toPrevious();
return true;
});
}
void _toPrevious() {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => MyHomePage(storage: widget.storage)));
}
void _aboutDialog(BuildContext context) {
// debugdebugPrint("Clicked title");
showDialog(
context: context,
builder: (BuildContext ctx) {
return AboutDialog(
applicationName: "Simple Notes",
applicationLegalese: "Made with <3 by EmaMaker.\nSource Code available under GPL v3.0 on https://github.com/EmaMaker/simple_notes",
applicationVersion: "v1.0",
);
});
}
@override
void dispose() {
super.dispose();