diff --git a/.gitignore b/.gitignore index 0fa6b67..a1345d0 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,6 @@ /build/ # Web related -lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols diff --git a/android/app/build.gradle b/android/app/build.gradle index 02149a4..ec6c878 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -21,6 +21,12 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } +def keystoreProperties = new Properties() + def keystorePropertiesFile = rootProject.file('key.properties') + if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + } + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" @@ -43,18 +49,41 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.todo" + applicationId "com.kaelstudio.todo" minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName + ndk { + debugSymbolLevel 'FULL' + } } buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + + ndk { + debugSymbolLevel 'FULL' + } + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile( + 'proguard-android-optimize.txt'), + 'proguard-rules.pro' + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + buildTypes { + release { + signingConfig signingConfigs.release + } + } } } } diff --git a/android/build.gradle b/android/build.gradle index 7af76c2..f4c918d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.6.0' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index cfe88f6..7de5a34 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -4,3 +4,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip +org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED diff --git a/deployment_cert.der b/deployment_cert.der new file mode 100644 index 0000000..3919314 --- /dev/null +++ b/deployment_cert.der @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDizCCAnOgAwIBAgIELKNhuDANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJm +cjETMBEGA1UECBMKdmFsIGQnb2lzZTEYMBYGA1UEBxMPdmlsbGllcnMgbGUgYmVs +MRMwEQYDVQQKEwprYWVsc3R1ZGlvMRMwEQYDVQQLEwprYWVsc3R1ZGlvMQ0wCwYD +VQQDEwRrYWVsMCAXDTIzMDkyOTE2MTcwM1oYDzIwNTEwMjE0MTYxNzAzWjB1MQsw +CQYDVQQGEwJmcjETMBEGA1UECBMKdmFsIGQnb2lzZTEYMBYGA1UEBxMPdmlsbGll +cnMgbGUgYmVsMRMwEQYDVQQKEhttps://developer.android.com/studio/publish/app-signing?hl=frwprYWVsc3R1ZGlvMRMwEQYDVQQLEwprYWVsc3R1 +ZGlvMQ0wCwYDVQQDEwRrYWVsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAhdixS6ZRPbsJFZX19VwZVCYZMcNgPHOmCHm1F/08ULTEzHImjCswgZhgfLey +oB5h9vgOFXw8nzlj9/8/RnQMhUNv90rL28aRpG4qOqkpnKztjCA2rrcaYuXA3l82 +3IQFO1FUKIZ2FnAL8h1P31OvBrAOTbgdKeOAClYF0h5NvYfQAeBYayKpQz2cQQ5C +K5nX3HbBeTIw3z6nQHnY85DA2BJPclR3ZBPGPppDbNFos6TSZpQk9Ro5Dk8NbKRY +J8B0aFY6VMTz3danpdZvK9oJQ2KK/EiX9UoRxjIykexxF5C5U2szoEQmHwKkcOMO +hIW91qFhH7ymHvByz/HI/29gDQIDAQABoyEwHzAdBgNVHQ4EFgQUTzO7LFDHBN8a +4YFu/sWgXgvBpdcwDQYJKoZIhvcNAQELBQADggEBAGYargwG85QwN6TWAuiV3gjs +/F2Axoe2rMYkg4mqh53M0qbqOZagY5cCzOShTe7wnd5+VXZ1yYr3M/PliGbzXald +gf8LpJb8LvpR8z3/EcO9FnsJAREncU4DYIzUynzfReAekOPizP4yL0XBPChf6jtk +C5EkFm0u2vAMgHkt6pGsWGynvPi/S8JILb09uyye5xBtBrTB8j0MIJ85/3Qfv8t0 +7x+KDkQ7qx9tu17PM+rF+XO9O0h4/giWsZJmVXIR/DBDNhXy+8RaqWKOjgLgG4vo +Q3tCtivp7ywDmSIQRgk2N8heLgRFJZb/3TB8kHTnUQqG9i8pemeAgXRRmqhyByo= +-----END CERTIFICATE----- diff --git a/lib/main.dart b/lib/main.dart index a2e3dcd..eb96e8d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,7 +6,7 @@ void main() async { //init hive await Hive.initFlutter(); //open the box - var box = await Hive.openBox('todoBox'); + await Hive.openBox('todoBox'); runApp(const MyApp()); } @@ -23,11 +23,12 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( - title: 'Todo', + title: 'Tody', + debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.red, ), - home: const MyHomePage(title: 'Ma liste de tache'), + home: const MyHomePage(title: 'Tody'), ); } } diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 5e33d33..cbb6ad6 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -23,7 +23,6 @@ class _MyHomePageState extends State { @override void initState() { - // TODO: implement initState // first time if (_myBox.get('todos') == null) { db.createInitialData(); @@ -74,17 +73,43 @@ class _MyHomePageState extends State { return Scaffold( appBar: AppBar( title: Text(widget.title), + centerTitle: true, + ), + body: Column( + children: [ + Expanded( + child: ListView.builder( + itemCount: db.todoList.length, + itemBuilder: (context, index) { + return db.todoList[index][1] == false + ? ToDoTile( + taskName: db.todoList[index][0], + taskCompleted: db.todoList[index][1], + onChanged: (value) => checkBoxChanged(value, index), + deleteFunction: (context) => deleteTask(index), + ) + : SizedBox.shrink(); + }), + ), + Text( + "Tache complété : ${db.todoList.where((element) => element[1] == true).length}"), + //task completed + Expanded( + child: ListView.builder( + itemCount: db.todoList.length, + itemBuilder: (context, index) { + return db.todoList[index][1] == true + ? ToDoTile( + taskName: db.todoList[index][0], + taskCompleted: db.todoList[index][1], + onChanged: (value) => checkBoxChanged(value, index), + deleteFunction: (context) => deleteTask(index), + ) + : Container(); + }), + ), + ], ), - body: ListView.builder( - itemCount: db.todoList.length, - itemBuilder: (context, index) { - return ToDoTile( - taskName: db.todoList[index][0], - taskCompleted: db.todoList[index][1], - onChanged: (value) => checkBoxChanged(value, index), - deleteFunction: (context) => deleteTask(index), - ); - }), floatingActionButton: FloatingActionButton( onPressed: createNewTask, tooltip: 'Increment', diff --git a/lib/utils/dialog_box.dart b/lib/utils/dialog_box.dart index 6a38042..7114f12 100644 --- a/lib/utils/dialog_box.dart +++ b/lib/utils/dialog_box.dart @@ -2,39 +2,54 @@ import 'package:flutter/material.dart'; import 'package:todo/utils/my_button.dart'; class DialogBox extends StatelessWidget { - DialogBox( + const DialogBox( {Key? key, required this.controller, required this.onSave, required this.onCancel}) : super(key: key); - final controller; - VoidCallback onSave; - VoidCallback onCancel; + final TextEditingController controller; + final VoidCallback onSave; + final VoidCallback onCancel; @override Widget build(BuildContext context) { return AlertDialog( backgroundColor: Theme.of(context).primaryColor, - title: Text("New Task"), - content: Container( + title: const Text( + "Nouvelle tache", + style: TextStyle(color: Colors.white), + ), + content: SizedBox( height: 120, child: Column( children: [ TextField( controller: controller, - decoration: InputDecoration( - border: OutlineInputBorder(), hintText: "Add new task"), + autofocus: true, + style: const TextStyle(color: Colors.white), + decoration: const InputDecoration( + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.white), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.white), + ), + border: OutlineInputBorder( + gapPadding: 4, borderSide: BorderSide(color: Colors.white)), + hintText: "Ajouter une tache", + hintStyle: TextStyle(color: Colors.white), + ), ), - SizedBox( + const SizedBox( height: 40, ), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - MyButton(text: "Cancel", onPressed: onCancel), - MyButton(text: "Save", onPressed: onSave), + MyButton(text: "Annuler", onPressed: onCancel), + MyButton(text: "Sauvegarder", onPressed: onSave), ], ) ], diff --git a/lib/utils/my_button.dart b/lib/utils/my_button.dart index 01221e7..ff81903 100644 --- a/lib/utils/my_button.dart +++ b/lib/utils/my_button.dart @@ -1,18 +1,18 @@ import 'package:flutter/material.dart'; class MyButton extends StatelessWidget { - MyButton({Key? key, required this.text, required this.onPressed}) + const MyButton({Key? key, required this.text, required this.onPressed}) : super(key: key); final String text; - VoidCallback onPressed; + final VoidCallback onPressed; @override Widget build(BuildContext context) { return MaterialButton( onPressed: onPressed, color: Theme.of(context).primaryColor, - child: Text(text), + child: Text(text, style: const TextStyle(color: Colors.white)), ); } } diff --git a/lib/utils/todo_tile.dart b/lib/utils/todo_tile.dart index 283374e..4ac4751 100644 --- a/lib/utils/todo_tile.dart +++ b/lib/utils/todo_tile.dart @@ -18,27 +18,28 @@ class ToDoTile extends StatelessWidget { @override Widget build(BuildContext context) { return Padding( - padding: const EdgeInsets.fromLTRB(25.0, 25, 25, 0), + padding: const EdgeInsets.fromLTRB(15.0, 15, 15, 0), child: Slidable( endActionPane: ActionPane( - motion: StretchMotion(), + motion: const StretchMotion(), children: [ SlidableAction( onPressed: deleteFunction, icon: Icons.delete, - backgroundColor: const Color.fromARGB(255, 249, 137, 135), + backgroundColor: Color.fromARGB(255, 249, 137, 135), borderRadius: BorderRadius.circular(12), ) ], ), child: Container( - padding: EdgeInsets.all(24.0), + padding: const EdgeInsets.all(10.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( taskName, style: TextStyle( + color: Colors.white, decoration: taskCompleted ? TextDecoration.lineThrough : TextDecoration.none), @@ -46,12 +47,19 @@ class ToDoTile extends StatelessWidget { Checkbox( value: taskCompleted, onChanged: onChanged, - activeColor: Colors.redAccent, + side: + MaterialStateBorderSide.resolveWith((states) => BorderSide( + width: 2, + color: Colors.white, + )), + focusColor: Colors.white, + checkColor: Colors.white, + activeColor: taskCompleted ? Colors.grey : Colors.redAccent, ) ], ), decoration: BoxDecoration( - color: Theme.of(context).primaryColor, + color: taskCompleted ? Colors.grey : Theme.of(context).primaryColor, borderRadius: BorderRadius.circular(10.0), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 6fa7b76..6b7384a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 +version: 1.0.1+11 environment: sdk: ">=2.15.1 <3.0.0" diff --git a/upload-keystore.jks b/upload-keystore.jks new file mode 100644 index 0000000..8150560 Binary files /dev/null and b/upload-keystore.jks differ diff --git a/upload-keystore.jks.old b/upload-keystore.jks.old new file mode 100644 index 0000000..e741cb5 Binary files /dev/null and b/upload-keystore.jks.old differ