Sure! Here is the complete README file in Markdown syntax:
This is a simple and intuitive note-taking app built with Flutter. It allows you to create, update, delete, and view notes. The app also features a settings page where you can toggle between dark and light modes. The notes are stored locally using the Isar database.
- Home Page: View all your notes in one place.
- Add Note: Click the add button to open a pop-up window where you can add a new note.
- Update Note: Update existing notes.
- Delete Note: Delete notes that you no longer need.
- Settings Page: Switch between dark and light modes.
- Local Storage: Notes are stored locally using the Isar database.
Home Page (Light Mode) | Drawer (Light Mode) |
---|---|
Settings Page (Dark Mode) | Note Tile (Dark Mode) |
---|---|
Update Note (Dark Mode) | Create Note (Dark Mode) |
---|---|
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Install dependencies:
flutter pub get
-
Run the app:
flutter run
- View Notes: On the home page, you can see all the notes you have created.
- Add Note: Click the add button (typically a floating action button) to open a pop-up window where you can enter the text for your new note.
- Enter the text for your new note in the pop-up window and click the save button to add it to your list of notes.
- Update: Click on an existing note to edit its text.
- Delete: Swipe left on a note or click the delete button to remove it.
- Toggle Mode: Open the settings page from the navigation drawer or a settings icon. Here, you can switch between dark mode and light mode.
The app uses the Isar database to store notes locally. Isar is a high-performance database designed for Flutter and Dart.
To initialize the Isar database, ensure you have the following setup in your code:
import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:developer';
import 'dart:io';
class NoteDatabase extends ChangeNotifier {
static late Isar isar;
static Future<void> clearDatabase() async {
final dir = await getApplicationDocumentsDirectory();
final dbDir = Directory(dir.path);
if (await dbDir.exists()) {
dbDir.deleteSync(recursive: true);
}
}
static Future<void> initialize() async {
try {
await clearDatabase();
final dir = await getApplicationDocumentsDirectory();
log('Database directory: ${dir.path}');
isar = await Isar.open([NoteSchema], directory: dir.path);
log('Database initialized successfully');
} catch (e) {
log('Error initializing database: $e');
rethrow;
}
}
}
Ensure your schema is defined correctly:
import 'package:isar/isar.dart';
// Generates the file
// Run dart run build_runner build
part 'note.g.dart';
@Collection()
class Note {
Id id = Isar.autoIncrement;
late String text;
}