app icons

This commit is contained in:
randogoth 2025-02-22 19:11:10 +02:00
parent be43333da6
commit 4fcd6db6fd
30 changed files with 331 additions and 216 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground>
<inset
android:drawable="@drawable/ic_launcher_foreground"
android:inset="16%" />
</foreground>
<monochrome>
<inset
android:drawable="@drawable/ic_launcher_monochrome"
android:inset="16%" />
</monochrome>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 2.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 5 KiB

Before After
Before After

28
assets/blaster.svg Normal file
View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg
fill="#000000"
height="800"
width="800"
version="1.1"
id="Layer_1"
viewBox="0 0 512 512"
xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs2" />
<g
id="g2"
transform="matrix(-1,0,0,1,512,0)"
style="fill:#ffffff">
<g
id="g1"
style="fill:#ffffff">
<path
d="m 466.824,173.176 v -30.118 c 0,-12.475 -10.114,-22.588 -22.588,-22.588 -12.474,0 -22.588,10.114 -22.588,22.588 0,-12.475 -10.114,-22.588 -22.588,-22.588 -12.474,0 -22.588,10.114 -22.588,22.588 0,-12.475 -10.114,-22.588 -22.588,-22.588 -9.83,0 -18.17,6.292 -21.275,15.059 H 90.353 V 90.353 H 45.176 v 45.176 L 0,173.176 v 45.177 l 90.353,97.879 -45.177,30.121 v 75.294 h 90.353 l 43.4,-119.35 30.068,30.068 31.944,-31.944 L 196.522,256 h 136.085 c 3.105,8.767 11.445,15.059 21.275,15.059 12.475,0 22.588,-10.114 22.588,-22.588 0,12.475 10.113,22.588 22.588,22.588 12.475,0 22.588,-10.114 22.588,-22.588 0,12.475 10.113,22.588 22.588,22.588 12.475,0 22.588,-10.114 22.588,-22.588 V 218.353 H 512 V 173.176 Z M 195.765,218.353 H 90.353 v -45.177 h 105.412 z"
id="path1"
style="fill:#ffffff" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/blaster_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

BIN
assets/blaster_fg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
assets/blaster_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
assets/blaster_mono.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -3,8 +3,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_code_editor/flutter_code_editor.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_markdown_latex/flutter_markdown_latex.dart';
import 'package:flutter_svg/svg.dart';
import 'package:markdown/markdown.dart' as md;
import 'package:path/path.dart' as path;
import 'package:shared_preferences/shared_preferences.dart';
import 'themes/day.dart';
import 'themes/night.dart';
import 'themes/markdown.dart';
@ -25,57 +26,102 @@ class NoteEditorScreen extends StatefulWidget {
}
class _NoteEditorScreenState extends State<NoteEditorScreen> {
bool isLoading = true;
bool _isPreviewMode = false; // Default: Editing mode
late CodeController _controller;
double _fontSize = 16.0; // Default font size
late String _initialContent;
bool _isPreviewMode = false;
bool _isLoading = true;
bool _autoSaveEnabled = false; // Controlled by user toggle
double _fontSize = 16.0;
@override
void initState() {
super.initState();
_loadPreferences();
_loadNoteContent();
}
Future<void> _loadPreferences() async {
final prefs = await SharedPreferences.getInstance();
setState(() {
_autoSaveEnabled = prefs.getBool('auto_save_enabled') ?? false;
});
}
Future<void> _setAutoSaveEnabled(bool value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool('auto_save_enabled', value);
setState(() {
_autoSaveEnabled = value;
});
}
Future<void> _loadNoteContent() async {
String content = "";
try {
content = await widget.note.readAsString();
_initialContent = await widget.note.readAsString();
} catch (e) {
print("❌ Failed to read file: ${widget.note.path}");
_initialContent = "";
}
setState(() {
_controller = CodeController(
text: content,
text: _initialContent,
language: markdown,
);
_controller.addListener(_saveNote);
_controller.popupController.enabled = false;
isLoading = false;
_controller.addListener(_onTextChanged);
_isLoading = false;
});
}
void _onTextChanged() {
if (_autoSaveEnabled && _controller.text != _initialContent) {
_saveNote();
}
}
Future<void> _saveNote() async {
try {
final notesDirectory = widget.notesDirectoryPath ??
widget.note.parent.path; // Use correct directory
if (_controller.text == _initialContent) return; // No change, skip saving
// Get the full path of the original file, preserving subfolder structure
final relativeNotePath = path.relative(widget.note.path, from: notesDirectory);
final newFilePath = path.join(notesDirectory, relativeNotePath); // Preserve subfolder
await widget.note.writeAsString(_controller.text);
_initialContent = _controller.text; // Update initial state
print("📝 Attempting to save note at: $newFilePath");
final newFile = File(newFilePath);
await newFile.writeAsString(_controller.text);
print("✅ Successfully saved note at: $newFilePath");
} catch (e, stackTrace) {
print("✅ Note saved successfully");
} catch (e) {
print("❌ Error saving note: ${widget.note.path}");
print("⚠️ Exception: $e");
print("🛠 Stack trace: $stackTrace");
}
}
Future<bool> _onWillPop() async {
if (_controller.text == _initialContent) return true; // No changes, exit
return await showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text("Save Changes?"),
content: Text("You have unsaved changes. Save before exiting?"),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(true), // Discard and exit
child: Text("Discard"),
),
TextButton(
onPressed: () async {
await _saveNote();
Navigator.of(context).pop(true); // Save and exit
},
child: Text("Save"),
),
TextButton(
onPressed: () => Navigator.of(context).pop(false), // Stay on page
child: Text("Cancel"),
),
],
),
) ??
false;
}
void _updateFontSize(double newSize) {
setState(() {
_fontSize = newSize;
@ -84,138 +130,153 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
@override
void dispose() {
_controller.removeListener(_saveNote);
_controller.removeListener(_onTextChanged);
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.note.uri.pathSegments.last.replaceAll('.md', '')),
actions: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: PopupMenuButton<String>(
icon: Icon(Icons.radio_button_checked, color: Colors.orange),
onSelected: (String value) {
if (value == 'Toggle Preview') {
setState(() {
_isPreviewMode = !_isPreviewMode;
});
}
return WillPopScope(
onWillPop: _onWillPop,
child: Scaffold(
appBar: AppBar(
title: Text(widget.note.uri.pathSegments.last.replaceAll('.md', '')),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () async {
if (await _onWillPop()) {
Navigator.pop(context);
}
},
),
actions: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: PopupMenuButton<String>(
icon: SvgPicture.asset(
"assets/blaster.svg",
width: 30,
color: Colors.orange,
),
onSelected: (String value) {
switch (value) {
case 'Save':
_saveNote();
break;
case 'Toggle Autosave':
_setAutoSaveEnabled(!_autoSaveEnabled);
break;
case 'Toggle Preview':
setState(() {
_isPreviewMode = !_isPreviewMode;
});
break;
}
},
itemBuilder: (BuildContext context) => [
PopupMenuItem<String>(
value: 'Save',
child: ListTile(
leading: Icon(Icons.save),
title: Text("Save"),
),
),
PopupMenuItem<String>(
value: 'Toggle Autosave',
child: ListTile(
leading: Icon(_autoSaveEnabled
? Icons.toggle_on
: Icons.toggle_off),
title: Text(_autoSaveEnabled
? "Disable Autosave"
: "Enable Autosave"),
),
),
PopupMenuItem<String>(
value: 'Toggle Preview',
child: ListTile(
leading:
Icon(_isPreviewMode ? Icons.edit : Icons.preview),
title:
Text(_isPreviewMode ? "Edit Mode" : "Preview Mode"),
),
),
],
),
),
],
),
body: _isLoading
? Center(child: CircularProgressIndicator())
: _isPreviewMode
? Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: MarkdownBody(
builders: {
'latex': LatexElementBuilder(
textStyle: TextStyle(
color: widget.isDarkMode
? Colors.white
: Colors.black)),
},
itemBuilder: (BuildContext context) => [
PopupMenuItem<String>(
value: 'Toggle Preview',
child: ListTile(
leading: Icon(_isPreviewMode ? Icons.edit : Icons.preview),
title: Text(_isPreviewMode ? 'Edit Mode' : 'Preview Mode'),
),
),
PopupMenuItem<String>(
enabled: false,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Font Size'),
StatefulBuilder(
builder: (context, setState) {
return Slider(
value: _fontSize,
min: 12.0,
max: 24.0,
divisions: 6,
label: _fontSize.toString(),
onChanged: (newSize) {
setState(() {
_fontSize = newSize;
});
_updateFontSize(newSize);
},
);
},
),
],
),
),
],
extensionSet: md.ExtensionSet(
[LatexBlockSyntax()],
[LatexInlineSyntax()],
),
data: _controller.text,
selectable: true,
styleSheet: MarkdownStyleSheet(
p: TextStyle(
fontSize: _fontSize,
color: widget.isDarkMode
? Colors.white
: Colors.black),
h1: TextStyle(
fontSize: _fontSize + 8,
color: widget.isDarkMode
? Colors.white
: Colors.black,
fontWeight: FontWeight.bold),
h2: TextStyle(
fontSize: _fontSize + 6,
color: widget.isDarkMode
? Colors.white
: Colors.black,
fontWeight: FontWeight.bold),
h3: TextStyle(
fontSize: _fontSize + 4,
color: widget.isDarkMode
? Colors.white
: Colors.black,
fontWeight: FontWeight.bold),
code: TextStyle(
fontSize: _fontSize,
backgroundColor: Colors.transparent),
codeblockDecoration: BoxDecoration(
color: Colors.transparent),
),
),
),
],
),
body: isLoading
? Center(
child:
CircularProgressIndicator()) // Show loader while initializing
: _isPreviewMode
? Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: MarkdownBody(
builders: {
'latex': LatexElementBuilder(
textStyle: TextStyle(
color: widget.isDarkMode
? Colors.white
: Colors.black)),
},
extensionSet: md.ExtensionSet(
[LatexBlockSyntax()],
[LatexInlineSyntax()],
),
data: _controller
.text, // Plain Markdown without syntax highlighting
selectable: true, // Allows text selection
styleSheet: MarkdownStyleSheet(
p: TextStyle(
fontSize: _fontSize,
color: widget.isDarkMode
? Colors.white
: Colors.black),
h1: TextStyle(
fontSize: _fontSize + 8,
color:
widget.isDarkMode ? Colors.white : Colors.black,
fontWeight: FontWeight.bold),
h2: TextStyle(
fontSize: _fontSize + 6,
color:
widget.isDarkMode ? Colors.white : Colors.black,
fontWeight: FontWeight.bold),
h3: TextStyle(
fontSize: _fontSize + 4,
color:
widget.isDarkMode ? Colors.white : Colors.black,
fontWeight: FontWeight.bold),
code: TextStyle(
fontSize: _fontSize,
backgroundColor: Colors
.transparent), // Disables syntax highlighting
codeblockDecoration: BoxDecoration(
color: Colors
.transparent), // Removes background color from code blocks
),
),
),
)
: Padding(
padding: const EdgeInsets.all(16.0),
child: CodeTheme(
data: CodeThemeData(
styles: widget.isDarkMode ? nightTheme : dayTheme),
child: SingleChildScrollView(
child: WrappedCodeField(
wrap: true,
controller: _controller,
textStyle: TextStyle(
fontSize: _fontSize,
),
),
),
),
)
: Padding(
padding: const EdgeInsets.all(16.0),
child: CodeTheme(
data: CodeThemeData(
styles: widget.isDarkMode ? nightTheme : dayTheme),
child: SingleChildScrollView(
child: WrappedCodeField(
wrap: true,
controller: _controller,
textStyle: TextStyle(
fontSize: _fontSize,
),
),
),
),
),
),
);
}
}

View file

@ -1,6 +1,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:open_filex/open_filex.dart';
import 'package:path/path.dart' as path;
@ -396,6 +397,7 @@ class _NoteListScreenState extends State<NoteListScreen> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 3),
content: Text('Note moved to trash'),
action: SnackBarAction(
label: 'Undo',
@ -502,6 +504,7 @@ class _NoteListScreenState extends State<NoteListScreen> {
autocorrect: false,
textInputAction: TextInputAction.done,
controller: searchController,
cursorColor: Colors.orange,
decoration: InputDecoration(
hintText: 'Search or enter a command...',
border: InputBorder.none,
@ -521,8 +524,11 @@ class _NoteListScreenState extends State<NoteListScreen> {
Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: PopupMenuButton<String>(
icon: Icon(Icons.radio_button_checked,
color: Colors.orange), // Menu button ()
icon: SvgPicture.asset(
"assets/blaster.svg",
width: 30,
color: Colors.orange,
),
onSelected: (String value) {
switch (value) {
case 'Toggle Tags':

View file

@ -1,6 +1,14 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
sha256: "528579c7e4579719f04b21eeeeddfd73a18b31dabc22766893b7d1be7f49b967"
url: "https://pub.dev"
source: hosted
version: "4.0.3"
args:
dependency: transitive
description:
@ -49,6 +57,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.4.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted
version: "2.0.3"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
url: "https://pub.dev"
source: hosted
version: "0.4.2"
clock:
dependency: transitive
description:
@ -150,6 +174,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.0"
flutter_launcher_icons:
dependency: "direct main"
description:
name: flutter_launcher_icons
sha256: bfa04787c85d80ecb3f8777bde5fc10c3de809240c48fa061a2c2bf15ea5211c
url: "https://pub.dev"
source: hosted
version: "0.14.3"
flutter_lints:
dependency: "direct dev"
description:
@ -191,7 +223,7 @@ packages:
source: hosted
version: "2.0.24"
flutter_svg:
dependency: transitive
dependency: "direct main"
description:
name: flutter_svg
sha256: c200fd79c918a40c5cd50ea0877fa13f81bdaf6f0a5d3dbcc2a13e3285d6aa1b
@ -248,6 +280,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.2"
image:
dependency: transitive
description:
name: image
sha256: "13d3349ace88f12f4a0d175eb5c12dcdd39d35c4c109a8a13dfeb6d0bd9e31c3"
url: "https://pub.dev"
source: hosted
version: "4.5.3"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.9.0"
leak_tracker:
dependency: transitive
description:
@ -480,6 +528,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.8"
posix:
dependency: transitive
description:
name: posix
sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a
url: "https://pub.dev"
source: hosted
version: "6.0.1"
provider:
dependency: transitive
description:
@ -757,6 +813,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.5.0"
yaml:
dependency: transitive
description:
name: yaml
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
url: "https://pub.dev"
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.6.0 <4.0.0"
flutter: ">=3.27.0"

View file

@ -1,38 +1,14 @@
name: muzzlevelocity
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: ^3.6.0
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
file_picker: ^9.0.0
flutter_highlight: ^0.7.0
@ -47,56 +23,22 @@ dependencies:
shared_preferences: ^2.5.2
highlight: ^0.7.0
open_filex: ^4.6.0
flutter_svg: ^2.0.17
flutter_launcher_icons: ^0.14.3
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/to/asset-from-package
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/to/font-from-package
flutter_launcher_icons:
android: true
image_path: "assets/blaster_icon.png"
adaptive_icon_background: "assets/blaster_bg.png"
adaptive_icon_foreground: "assets/blaster_fg.png"
adaptive_icon_monochrome: "assets/blaster_mono.png"