-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed plugin issue working on implementation
- Loading branch information
1 parent
6b7071f
commit 5242c05
Showing
11 changed files
with
183 additions
and
66 deletions.
There are no files selected for viewing
39 changes: 38 additions & 1 deletion
39
android/app/src/main/kotlin/com/example/to_do_app/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,43 @@ | ||
package com.example.to_do_app | ||
|
||
import android.content.ContentResolver | ||
import android.content.Context | ||
import android.media.RingtoneManager | ||
import android.os.Bundle | ||
import io.flutter.embedding.android.FlutterActivity | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugin.common.MethodChannel | ||
import java.util.* | ||
|
||
class MainActivity: FlutterActivity() { | ||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { | ||
super.configureFlutterEngine(flutterEngine) | ||
|
||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "example.dev/to_do_app").setMethodCallHandler { call, result -> | ||
if ("drawableToUri" == call.method) { | ||
val resourceId = this@MainActivity.resources.getIdentifier(call.arguments as String, "drawable", this@MainActivity.packageName) | ||
result.success(resourceToUriString(this@MainActivity.applicationContext, resourceId)) | ||
} | ||
if ("getAlarmUri" == call.method) { | ||
result.success(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM).toString()) | ||
} | ||
if ("getTimeZoneName" == call.method) { | ||
result.success(TimeZone.getDefault().id) | ||
} | ||
} | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
ImagePickerPlugin.registerWith(registrarFor("io.flutter.plugins.imagepicker.ImagePickerPlugin")) | ||
SqflitePlugin.registerWith(registrarFor("com.tekartik.sqflite.SqflitePlugin")) | ||
} | ||
|
||
private fun resourceToUriString(context: Context, resId: Int): String? { | ||
return (ContentResolver.SCHEME_ANDROID_RESOURCE + "://" | ||
+ context.resources.getResourcePackageName(resId) | ||
+ "/" | ||
+ context.resources.getResourceTypeName(resId) | ||
+ "/" | ||
+ context.resources.getResourceEntryName(resId)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
import UIKit | ||
import Flutter | ||
import flutter_local_notifications | ||
import flutter_timezone | ||
|
||
@UIApplicationMain | ||
class AppDelegate: FlutterAppDelegate { | ||
|
||
override func application( | ||
_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
) -> Bool { | ||
|
||
// Set up the plugin registrant callback for FlutterLocalNotificationsPlugin | ||
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { registry in | ||
GeneratedPluginRegistrant.register(with: registry) | ||
} | ||
|
||
// Your other setup code... | ||
|
||
// Set up the plugin registrant callback for FlutterLocalNotificationsPlugin | ||
GeneratedPluginRegistrant.register(with: self) | ||
return super.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:to_do_app/screens/widgets/repeat_task_container.dart'; | ||
|
||
class RepeatTaskScreen extends StatefulWidget { | ||
const RepeatTaskScreen({super.key}); | ||
|
||
@override | ||
State<RepeatTaskScreen> createState() => _RepeatTaskScreenState(); | ||
} | ||
|
||
class _RepeatTaskScreenState extends State<RepeatTaskScreen> { | ||
List<String> repeatDaysChoices = [ | ||
"Monday", | ||
"Tuesday", | ||
"Wednesday", | ||
"Thursday", | ||
"Friday", | ||
"Saturday", | ||
"Sunday", | ||
]; | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text("Repeat"), | ||
), | ||
body: ListView.builder( | ||
itemCount: repeatDaysChoices.length, | ||
itemBuilder: (context, index) { | ||
return TaskContainer( | ||
leadingText: repeatDaysChoices[index], | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:to_do_app/providers/settings_provider.dart'; | ||
|
||
class TaskContainer extends ConsumerStatefulWidget { | ||
const TaskContainer({super.key, required this.leadingText}); | ||
|
||
final String leadingText; | ||
|
||
@override | ||
ConsumerState<TaskContainer> createState() => _TaskContainerState(); | ||
} | ||
|
||
class _TaskContainerState extends ConsumerState<TaskContainer> { | ||
@override | ||
Widget build(BuildContext context) { | ||
String selectedDays; | ||
bool isPressed = false; | ||
|
||
final theme = ref.watch(settingsProvider); | ||
|
||
return Padding( | ||
padding: const EdgeInsets.only(top: 20, left: 10, right: 10), | ||
child: InkWell( | ||
onTap: () { | ||
setState(() { | ||
isPressed = !isPressed; | ||
}); | ||
}, | ||
child: ListTile( | ||
leadingAndTrailingTextStyle: const TextStyle(fontSize: 17), | ||
dense: true, | ||
textColor: theme.isLightMode ? Colors.black : Colors.white, | ||
leading: Text(widget.leadingText), | ||
trailing: isPressed == true | ||
? Icon( | ||
Icons.check, | ||
color: Theme.of(context).colorScheme.primary, | ||
size: 30, | ||
grade: BorderSide.strokeAlignOutside, | ||
fill: 20, | ||
) | ||
: null)), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters