display filename on top bar

rearrange some imports
add linter rules
This commit is contained in:
lukas-heiligenbrunner 2022-10-30 21:57:13 +01:00
parent ab1bacea00
commit 84eef41996
11 changed files with 78 additions and 52 deletions

View File

@ -22,8 +22,17 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
avoid_print: false # Uncomment to disable the `avoid_print` rule
avoid_print: true # Uncomment to disable the `avoid_print` rule
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
prefer_relative_imports: true
avoid_empty_else: true
avoid_returning_null_for_future: true
avoid_web_libraries_in_flutter: true
collection_methods_unrelated_type: true
comment_references: true
control_flow_in_finally: true
empty_statements: true
unnecessary_null_checks: true
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:notes/context/file_change_notifier.dart';
import 'package:provider/provider.dart';
import 'canvas/drawing_page.dart';
import 'context/file_change_notifier.dart';
import 'pages/all_notes_page.dart';
import 'widgets/collapse_drawer.dart';
@ -51,13 +51,17 @@ class _AppState extends State<App> {
return FloatingActionButton(
onPressed: () async {
final now = DateTime.now();
String filename =
'note-${now.year}_${now.month}_${now.day}-${now.hour}_${now.minute}.dbnote';
final name =
'note-${now.year}_${now.month}_${now.day}-${now.hour}_${now.minute}';
final filename = '$name.dbnote';
Navigator.push(
context,
MaterialPageRoute(
builder: (ctx) => DrawingPage(filePath: filename),
builder: (ctx) => DrawingPage(
filePath: filename,
name: name,
),
),
).then((value) =>
Provider.of<FileChangeNotifier>(context, listen: false)

View File

@ -35,6 +35,7 @@ class Stroke {
}
Stroke.fromPoints(this.points, this.id, this.color);
Stroke(this.id, this.color);
}

View File

@ -1,22 +1,25 @@
import 'dart:math';
import 'dart:ui';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:notes/savesystem/note_file.dart';
import '../savesystem/note_file.dart';
import '../widgets/icon_material_button.dart';
import '../widgets/tool_bar.dart';
import 'my_painter.dart';
import 'paint_controller.dart';
import 'screen_document_mapping.dart';
import '../widgets/icon_material_button.dart';
import '../widgets/tool_bar.dart';
/// Handles input events and draws canvas element
class DrawingPage extends StatefulWidget {
// path to the .dbnote file
final String filePath;
final String name;
const DrawingPage({Key? key, required this.filePath}) : super(key: key);
const DrawingPage({Key? key, required this.filePath, required this.name})
: super(key: key);
@override
State<DrawingPage> createState() => _DrawingPageState();
@ -53,7 +56,10 @@ class _DrawingPageState extends State<DrawingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(backgroundColor: Colors.blueGrey, actions: [
appBar: AppBar(
backgroundColor: Colors.blueGrey,
title: Text(widget.name),
actions: [
IconMaterialButton(
icon: const Icon(FluentIcons.book_open_48_filled),
color: const Color.fromRGBO(255, 255, 255, .85),
@ -110,7 +116,7 @@ class _DrawingPageState extends State<DrawingPage> {
setState(() {
offset = Offset((-canvasWidth * zoom) + canvasWidth, newOffset.dy);
});
print(offset);
debugPrint(offset.toString());
} else {
setState(() {
offset = offset + delta;

View File

@ -1,8 +1,9 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:notes/canvas/paint_controller.dart';
import 'package:notes/canvas/screen_document_mapping.dart';
import 'paint_controller.dart';
import 'screen_document_mapping.dart';
final Rect a4Page =
Rect.fromPoints(const Offset(.0, .0), const Offset(210, 210 * sqrt2));

View File

@ -1,5 +1,6 @@
import 'dart:math';
import 'dart:ui';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

View File

@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:notes/context/file_change_notifier.dart';
import 'package:notes/widgets/icon_material_button.dart';
import 'package:notes/widgets/note_tile.dart';
import 'package:provider/provider.dart';
import '../context/file_change_notifier.dart';
import '../widgets/icon_material_button.dart';
import '../widgets/note_tile.dart';
class AllNotesPage extends StatefulWidget {
const AllNotesPage({Key? key}) : super(key: key);

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'note_file.dart';
import '../canvas/document_types.dart';
import 'note_file.dart';
extension LineLoading on NoteFile {
Future<List<Stroke>> loadStrokes() async {

View File

@ -1,8 +1,9 @@
import 'dart:io';
import 'package:notes/savesystem/path.dart';
import 'package:sqflite/sqflite.dart';
import 'path.dart';
class NoteFile {
late Database _db;
String filepath;

View File

@ -1,9 +1,10 @@
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:notes/context/file_change_notifier.dart';
import 'package:notes/widgets/drawer_item.dart';
import 'package:provider/provider.dart';
import '../context/file_change_notifier.dart';
import 'drawer_item.dart';
enum View { all, shared, recycle, folders }
class CollapseDrawer extends StatefulWidget {

View File

@ -24,7 +24,8 @@ class NoteTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DrawingPage(filePath: data.relativePath),
builder: (context) =>
DrawingPage(filePath: data.relativePath, name: data.name),
),
).then((value) =>
Provider.of<FileChangeNotifier>(context, listen: false)