minor fixes and additions

This commit is contained in:
Anuj K 2024-03-27 21:45:41 +05:30
parent 55049114c5
commit 5911153f1c
19 changed files with 164 additions and 54 deletions

View file

@ -23,7 +23,7 @@ if (flutterVersionName == null) {
} }
android { android {
namespace "com.example.easytodo" namespace "me.aiquiral.easytodo"
compileSdk flutter.compileSdkVersion compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
@ -42,7 +42,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.easytodo" applicationId "me.aiquiral.easytodo"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion flutter.minSdkVersion

Binary file not shown.

Binary file not shown.

BIN
dist/1.0.1/easytodo-1.0.1.AppImage vendored Executable file

Binary file not shown.

12
distribute_options.yaml Normal file
View file

@ -0,0 +1,12 @@
output: dist/
releases:
- name: release
jobs:
- name: linux-rpm
package:
platform: linux
target: rpm
- name: android-apk
package:
platform: android
target: apk

View file

@ -1,8 +0,0 @@
icons_launcher:
image_path: "assets/ic_logo_border.png"
platforms:
android:
enable: true
linux:
enable: true

View file

@ -1,9 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
import '../data/database.dart'; import '../data/database.dart';
import '../util/dialog_box.dart'; import '../util/dialog_box.dart';
import '../util/todo_tile.dart'; import '../util/todo_tile.dart';
Uri _url = Uri.parse('https://git.aiquiral.me/aiquiral/easytodo');
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
const HomePage({super.key}); const HomePage({super.key});
@ -12,27 +15,24 @@ class HomePage extends StatefulWidget {
} }
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
// reference the hive box
final _myBox = Hive.box('mybox'); final _myBox = Hive.box('mybox');
ToDoDataBase db = ToDoDataBase(); ToDoDataBase db = ToDoDataBase();
@override @override
void initState() { void initState() {
// if this is the 1st time ever openin the app, then create default data // initial data
if (_myBox.get("TODOLIST") == null) { if (_myBox.get("TODOLIST") == null) {
db.createInitialData(); db.createInitialData();
} else { } else {
// there already exists data // load data
db.loadData(); db.loadData();
} }
super.initState(); super.initState();
} }
// text controller
final _controller = TextEditingController(); final _controller = TextEditingController();
// checkbox was tapped
void checkBoxChanged(bool? value, int index) { void checkBoxChanged(bool? value, int index) {
setState(() { setState(() {
db.toDoList[index][1] = !db.toDoList[index][1]; db.toDoList[index][1] = !db.toDoList[index][1];
@ -40,7 +40,6 @@ class _HomePageState extends State<HomePage> {
db.updateDataBase(); db.updateDataBase();
} }
// save new task
void saveNewTask() { void saveNewTask() {
setState(() { setState(() {
db.toDoList.add([_controller.text, false]); db.toDoList.add([_controller.text, false]);
@ -50,7 +49,6 @@ class _HomePageState extends State<HomePage> {
db.updateDataBase(); db.updateDataBase();
} }
// create a new task
void createNewTask() { void createNewTask() {
showDialog( showDialog(
context: context, context: context,
@ -58,13 +56,17 @@ class _HomePageState extends State<HomePage> {
return DialogBox( return DialogBox(
controller: _controller, controller: _controller,
onSave: saveNewTask, onSave: saveNewTask,
onCancel: () => Navigator.of(context).pop(), onCancel: () {
setState(() {
_controller.clear();
});
Navigator.of(context).pop();
},
); );
}, },
); );
} }
// delete task
void deleteTask(int index) { void deleteTask(int index) {
setState(() { setState(() {
db.toDoList.removeAt(index); db.toDoList.removeAt(index);
@ -99,9 +101,21 @@ class _HomePageState extends State<HomePage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return const AlertDialog( return const AlertDialog(
title: Text("About"), title: Text("About"),
content: Text("Made by Anuj K."), content: SizedBox(
); height: 100,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Text(
"This application is made by Anuj Kaushik (a.k.a. Aiqurial).\nLicensed under AGPLv3."),
TextButton(
onPressed: _launchUrl,
child: Text("View Source Code"))
],
)));
}); });
}) })
]), ]),
@ -128,3 +142,9 @@ class _HomePageState extends State<HomePage> {
); );
} }
} }
Future<void> _launchUrl() async {
if (!await launchUrl(_url)) {
throw Exception('Could not launch $_url');
}
}

View file

@ -4,6 +4,7 @@ import 'my_button.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class DialogBox extends StatelessWidget { class DialogBox extends StatelessWidget {
// ignore: prefer_typing_uninitialized_variables
final controller; final controller;
VoidCallback onSave; VoidCallback onSave;
VoidCallback onCancel; VoidCallback onCancel;

View file

@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
} }

View file

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST

View file

@ -0,0 +1,6 @@
display_name: Easy ToDo
icon: assets/ic_logo_border.png
generic_name: Easy ToDo
categories:
- Utility
startup_notify: true

View file

@ -0,0 +1,17 @@
display_name: easytodo
package_name: easytodo
maintainer:
name: Anuj K
email: development@aiquiral.me
priority: optional
section: x11
installed_size: 6604
essential: false
icon: assets/ic_logo_border.png
postinstall_scripts:
- echo "Easy Todo installed."
postuninstall_scripts:
- echo "Easy ToDo removed."
startup_notify: true

View file

@ -0,0 +1,11 @@
icon: assets/ic_logo_border.png
summary: An easy to use ToDo List app.
group: Application/Productivity
vendor: Anuj K
packager: Anuj K
packagerEmail: development@aiquiral.me
license: AGPLv3
display_name: Easy ToDo
startup_notify: true

View file

@ -6,7 +6,9 @@ import FlutterMacOS
import Foundation import Foundation
import path_provider_foundation import path_provider_foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
} }

View file

@ -243,6 +243,11 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
frontend_server_client: frontend_server_client:
dependency: transitive dependency: transitive
description: description:
@ -656,6 +661,70 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.2" version: "2.2.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e"
url: "https://pub.dev"
source: hosted
version: "6.2.5"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745
url: "https://pub.dev"
source: hosted
version: "6.3.0"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "9149d493b075ed740901f3ee844a38a00b33116c7c5c10d7fb27df8987fb51d5"
url: "https://pub.dev"
source: hosted
version: "6.2.5"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811
url: "https://pub.dev"
source: hosted
version: "3.1.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234
url: "https://pub.dev"
source: hosted
version: "3.1.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "3692a459204a33e04bc94f5fb91158faf4f2c8903281ddd82915adecdb1a901d"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
url: "https://pub.dev"
source: hosted
version: "3.1.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -730,4 +799,4 @@ packages:
version: "3.1.2" version: "3.1.2"
sdks: sdks:
dart: ">=3.3.1 <4.0.0" dart: ">=3.3.1 <4.0.0"
flutter: ">=3.10.0" flutter: ">=3.19.0"

View file

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # 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 # 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. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.0 version: 1.0.1
environment: environment:
sdk: '>=3.3.1 <4.0.0' sdk: '>=3.3.1 <4.0.0'
@ -33,6 +33,7 @@ dependencies:
flutter_slidable: ^3.1.0 flutter_slidable: ^3.1.0
hive: ^2.2.3 hive: ^2.2.3
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
url_launcher:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.

View file

@ -1,30 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:easytodo/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}

View file

@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
} }

View file

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_windows
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST