Compare commits
63
Commits
4d3de751f3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3983366408 | ||
|
|
3ba7458056 | ||
|
|
a3d7e651f4 | ||
|
|
8678e935df | ||
|
|
9aed2b3ac1 | ||
|
|
6908623ba2 | ||
|
|
a9486727b2 | ||
|
|
e4ba71ad4b | ||
|
|
202ec599d6 | ||
|
|
fbffc0cf4a | ||
|
|
19f9dd9b3b | ||
|
|
b6a73c398e | ||
|
|
c5a209d41e | ||
|
|
852d28afcf | ||
|
|
dac65c8390 | ||
|
|
98991a3d02 | ||
|
|
36b8ce37ad | ||
|
|
7642c6faf2 | ||
|
|
b617724f0a | ||
|
|
4a83465d82 | ||
|
|
a383ebfe34 | ||
|
|
e0302e63e2 | ||
|
|
af3fd69688 | ||
|
|
738a48438e | ||
|
|
2849cec682 | ||
|
|
2544a3de9f | ||
|
|
4aa6926f5c | ||
|
|
cbb2e2c4b0 | ||
|
|
4097a79205 | ||
|
|
0eaac20e7e | ||
|
|
ea745c1cec | ||
|
|
fb278e4487 | ||
|
|
de926bce0e | ||
|
|
6810b84310 | ||
|
|
83da62b5d9 | ||
|
|
b085d3bfb6 | ||
|
|
2a1eb9d07f | ||
|
|
8fb58a4db1 | ||
|
|
e6ba3f1a1c | ||
|
|
305ecd20eb | ||
|
|
da59790796 | ||
|
|
11eff63314 | ||
|
|
3978359dc4 | ||
|
|
e593639217 | ||
|
|
74b25e4e8f | ||
|
|
69f7e0c87b | ||
|
|
4e2ca56a69 | ||
|
|
0a7675797b | ||
|
|
8bda4d593d | ||
|
|
f11ade393a | ||
|
|
59c9c539d2 | ||
|
|
1445c19933 | ||
|
|
e834499644 | ||
|
|
0f7d938ad7 | ||
|
|
b1c7fc8882 | ||
|
|
7c71f5fa3e | ||
|
|
ff9f3263ae | ||
|
|
b58b877bb0 | ||
|
|
ea1cb1da76 | ||
|
|
6092161df0 | ||
|
|
fd83fef528 | ||
|
|
3ff136f758 | ||
|
|
a8b6c9f8a3 |
Vendored
+25
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "fmassive",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fmassive (profile mode)",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "profile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fmassive (release mode)",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "release"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+2
-25
@@ -1,30 +1,7 @@
|
|||||||
# This file configures the analyzer, which statically analyzes Dart code to
|
|
||||||
# check for errors, warnings, and lints.
|
|
||||||
#
|
|
||||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
|
||||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
|
||||||
# invoked from the command line by running `flutter analyze`.
|
|
||||||
|
|
||||||
# The following line activates a set of recommended lints for Flutter apps,
|
|
||||||
# packages, and plugins designed to encourage good coding practices.
|
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
|
||||||
# included above or to enable additional rules. A list of all available lints
|
|
||||||
# and their documentation is published at
|
|
||||||
# https://dart-lang.github.io/linter/lints/index.html.
|
|
||||||
#
|
|
||||||
# Instead of disabling a lint rule for the entire project in the
|
|
||||||
# section below, it can also be suppressed for a single line of code
|
|
||||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
|
||||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
|
||||||
# producing the lint.
|
|
||||||
rules:
|
rules:
|
||||||
curly_braces_in_flow_control_structures: false
|
curly_braces_in_flow_control_structures: false
|
||||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
avoid_print: false
|
||||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
require_trailing_commas: true
|
||||||
|
|
||||||
# Additional information about this file can be found at
|
|
||||||
# https://dart.dev/guides/language/analysis-options
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.fmassive">
|
package="com.example.fmassive">
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
|
||||||
@@ -39,5 +39,14 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
</application>
|
|
||||||
|
<activity
|
||||||
|
android:name=".StopAlarm"
|
||||||
|
android:exported="true"
|
||||||
|
android:process=":remote" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".AlarmService"
|
||||||
|
android:exported="false" />
|
||||||
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
package com.example.fmassive
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.*
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.media.AudioAttributes
|
||||||
|
import android.media.MediaPlayer
|
||||||
|
import android.media.MediaPlayer.OnPreparedListener
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.*
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.core.app.NotificationCompat
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
class AlarmService : Service(), OnPreparedListener {
|
||||||
|
private var mediaPlayer: MediaPlayer? = null
|
||||||
|
private var vibrator: Vibrator? = null
|
||||||
|
|
||||||
|
private fun getBuilder(): NotificationCompat.Builder {
|
||||||
|
val context = applicationContext
|
||||||
|
val contentIntent = Intent(context, MainActivity::class.java)
|
||||||
|
val pendingContent =
|
||||||
|
PendingIntent.getActivity(context, 0, contentIntent, PendingIntent.FLAG_IMMUTABLE)
|
||||||
|
val addBroadcast = Intent(MainActivity.ADD_BROADCAST).apply {
|
||||||
|
setPackage(context.packageName)
|
||||||
|
}
|
||||||
|
val pendingAdd =
|
||||||
|
PendingIntent.getBroadcast(context, 0, addBroadcast, PendingIntent.FLAG_MUTABLE)
|
||||||
|
val stopBroadcast = Intent(MainActivity.STOP_BROADCAST)
|
||||||
|
stopBroadcast.setPackage(context.packageName)
|
||||||
|
val pendingStop =
|
||||||
|
PendingIntent.getBroadcast(context, 0, stopBroadcast, PendingIntent.FLAG_IMMUTABLE)
|
||||||
|
return NotificationCompat.Builder(context, MainActivity.CHANNEL_ID_PENDING)
|
||||||
|
.setSmallIcon(R.drawable.baseline_hourglass_bottom_24).setContentTitle("Resting")
|
||||||
|
.setContentIntent(pendingContent)
|
||||||
|
.addAction(R.drawable.launch_background, "Stop", pendingStop)
|
||||||
|
.addAction(R.drawable.launch_background, "Add 1 min", pendingAdd)
|
||||||
|
.setDeleteIntent(pendingStop)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("Range")
|
||||||
|
private fun getSettings(): Settings {
|
||||||
|
val db = DatabaseHelper(applicationContext).readableDatabase
|
||||||
|
val cursor = db.rawQuery("SELECT sound, no_sound, vibrate FROM settings", null)
|
||||||
|
cursor.moveToFirst()
|
||||||
|
val sound = cursor.getString(cursor.getColumnIndex("sound"))
|
||||||
|
val noSound = cursor.getInt(cursor.getColumnIndex("no_sound")) == 1
|
||||||
|
val vibrate = cursor.getInt(cursor.getColumnIndex("vibrate")) == 1
|
||||||
|
Log.d("AlarmService", "vibrate=$vibrate")
|
||||||
|
cursor.close()
|
||||||
|
return Settings(sound, noSound, vibrate)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun playSound(settings: Settings) {
|
||||||
|
if (settings.sound == null && !settings.noSound) {
|
||||||
|
Log.d("AlarmService", "Playing default alarm sound...")
|
||||||
|
mediaPlayer = MediaPlayer.create(applicationContext, R.raw.argon)
|
||||||
|
mediaPlayer?.start()
|
||||||
|
mediaPlayer?.setOnCompletionListener { vibrator?.cancel() }
|
||||||
|
} else if (settings.sound != null && !settings.noSound) {
|
||||||
|
Log.d("AlarmService", "Playing custom alarm sound ${settings.sound}...")
|
||||||
|
mediaPlayer = MediaPlayer().apply {
|
||||||
|
setAudioAttributes(
|
||||||
|
AudioAttributes.Builder()
|
||||||
|
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||||
|
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
setDataSource(applicationContext, Uri.parse(settings.sound))
|
||||||
|
prepare()
|
||||||
|
start()
|
||||||
|
setOnCompletionListener { vibrator?.cancel() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun doNotify(): Notification {
|
||||||
|
Log.d("AlarmService", "doNotify")
|
||||||
|
val alarmsChannel = NotificationChannel(
|
||||||
|
CHANNEL_ID_DONE,
|
||||||
|
CHANNEL_ID_DONE,
|
||||||
|
NotificationManager.IMPORTANCE_HIGH
|
||||||
|
)
|
||||||
|
alarmsChannel.description = "Alarms for rest timers."
|
||||||
|
alarmsChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
|
||||||
|
alarmsChannel.setSound(null, null)
|
||||||
|
val manager = applicationContext.getSystemService(
|
||||||
|
NotificationManager::class.java
|
||||||
|
)
|
||||||
|
manager.createNotificationChannel(alarmsChannel)
|
||||||
|
val builder = getBuilder()
|
||||||
|
val context = applicationContext
|
||||||
|
val finishIntent = Intent(context, StopAlarm::class.java)
|
||||||
|
val finishPending = PendingIntent.getActivity(
|
||||||
|
context, 0, finishIntent, PendingIntent.FLAG_IMMUTABLE
|
||||||
|
)
|
||||||
|
builder.setContentText("Timer finished.").setProgress(0, 0, false)
|
||||||
|
.setAutoCancel(true).setOngoing(true)
|
||||||
|
.setContentIntent(finishPending).setChannelId(CHANNEL_ID_DONE)
|
||||||
|
.setCategory(NotificationCompat.CATEGORY_ALARM).priority =
|
||||||
|
NotificationCompat.PRIORITY_HIGH
|
||||||
|
val notification = builder.build()
|
||||||
|
manager.notify(NOTIFICATION_ID_DONE, notification)
|
||||||
|
manager.cancel(MainActivity.NOTIFICATION_ID_PENDING)
|
||||||
|
return notification
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("Recycle")
|
||||||
|
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||||
|
Log.d("AlarmService", "onStartCommand")
|
||||||
|
val notification = doNotify()
|
||||||
|
startForeground(NOTIFICATION_ID_DONE, notification)
|
||||||
|
val settings = getSettings()
|
||||||
|
playSound(settings)
|
||||||
|
if (!settings.vibrate) return START_STICKY
|
||||||
|
val pattern = longArrayOf(0, 300, 1300, 300, 1300, 300)
|
||||||
|
vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
val vibratorManager =
|
||||||
|
getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
|
||||||
|
vibratorManager.defaultVibrator
|
||||||
|
} else {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
getSystemService(VIBRATOR_SERVICE) as Vibrator
|
||||||
|
}
|
||||||
|
val audioAttributes = AudioAttributes.Builder()
|
||||||
|
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||||
|
.setUsage(AudioAttributes.USAGE_ALARM)
|
||||||
|
.build()
|
||||||
|
vibrator!!.vibrate(VibrationEffect.createWaveform(pattern, 1), audioAttributes)
|
||||||
|
return START_STICKY
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBind(intent: Intent): IBinder? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPrepared(player: MediaPlayer) {
|
||||||
|
player.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
mediaPlayer?.stop()
|
||||||
|
mediaPlayer?.release()
|
||||||
|
vibrator?.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val CHANNEL_ID_DONE = "Alarm"
|
||||||
|
const val NOTIFICATION_ID_DONE = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.example.fmassive
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.database.sqlite.SQLiteDatabase
|
||||||
|
import android.database.sqlite.SQLiteOpenHelper
|
||||||
|
|
||||||
|
class DatabaseHelper(context: Context) :
|
||||||
|
SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
|
||||||
|
companion object {
|
||||||
|
private const val DATABASE_NAME = "massive.db"
|
||||||
|
private const val DATABASE_VERSION = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(db: SQLiteDatabase) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDowngrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,17 +18,15 @@ import io.flutter.embedding.engine.FlutterEngine
|
|||||||
import io.flutter.plugin.common.MethodChannel
|
import io.flutter.plugin.common.MethodChannel
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
class MainActivity : FlutterActivity() {
|
class MainActivity : FlutterActivity() {
|
||||||
private val CHANNEL = "com.massive/android"
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
||||||
super.configureFlutterEngine(flutterEngine)
|
super.configureFlutterEngine(flutterEngine)
|
||||||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
|
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, FLUTTER_CHANNEL).setMethodCallHandler {
|
||||||
call, result ->
|
call, result ->
|
||||||
if (call.method == "timer") {
|
if (call.method == "timer") {
|
||||||
val args = call.arguments as ArrayList<*>
|
val args = call.arguments as ArrayList<*>
|
||||||
timer(args[0] as Long)
|
timer(args[0] as Int)
|
||||||
} else {
|
} else {
|
||||||
result.notImplemented()
|
result.notImplemented()
|
||||||
}
|
}
|
||||||
@@ -40,15 +38,13 @@ class MainActivity : FlutterActivity() {
|
|||||||
private var running = false
|
private var running = false
|
||||||
|
|
||||||
private val stopReceiver = object : BroadcastReceiver() {
|
private val stopReceiver = object : BroadcastReceiver() {
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
Log.d("AlarmModule", "Received stop broadcast intent")
|
Log.d("MainActivity", "Received stop broadcast intent")
|
||||||
stop()
|
stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val addReceiver = object : BroadcastReceiver() {
|
private val addReceiver = object : BroadcastReceiver() {
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
add()
|
add()
|
||||||
}
|
}
|
||||||
@@ -57,61 +53,49 @@ class MainActivity : FlutterActivity() {
|
|||||||
init {
|
init {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
||||||
fun add() {
|
fun add() {
|
||||||
Log.d("AlarmModule", "Add 1 min to alarm.")
|
Log.d("MainActivity", "Add 1 min to alarm.")
|
||||||
countdownTimer?.cancel()
|
countdownTimer?.cancel()
|
||||||
val newMs = if (running) currentMs.toInt().plus(60000) else 60000
|
val newMs = if (running) currentMs.toInt().plus(60000) else 60000
|
||||||
countdownTimer = getTimer(newMs.toLong())
|
countdownTimer = getTimer(newMs)
|
||||||
countdownTimer?.start()
|
countdownTimer?.start()
|
||||||
running = true
|
running = true
|
||||||
//val manager = getManager()
|
val manager = getManager()
|
||||||
//manager.cancel(AlarmService.NOTIFICATION_ID_DONE)
|
manager.cancel(AlarmService.NOTIFICATION_ID_DONE)
|
||||||
//val intent = Intent(context, AlarmService::class.java)
|
val intent = Intent(context, AlarmService::class.java)
|
||||||
//context.stopService(intent)
|
context.stopService(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
||||||
fun stop() {
|
fun stop() {
|
||||||
Log.d("AlarmModule", "Stop alarm.")
|
Log.d("MainActivity", "Stop alarm.")
|
||||||
countdownTimer?.cancel()
|
countdownTimer?.cancel()
|
||||||
running = false
|
running = false
|
||||||
//val intent = Intent(context, AlarmService::class.java)
|
val intent = Intent(context, AlarmService::class.java)
|
||||||
//reactApplicationContext?.stopService(intent)
|
context.stopService(intent)
|
||||||
//val manager = getManager()
|
val manager = getManager()
|
||||||
//manager.cancel(AlarmService.NOTIFICATION_ID_DONE)
|
manager.cancel(AlarmService.NOTIFICATION_ID_DONE)
|
||||||
//manager.cancel(NOTIFICATION_ID_PENDING)
|
manager.cancel(NOTIFICATION_ID_PENDING)
|
||||||
//val params = Arguments.createMap().apply {
|
|
||||||
// putString("minutes", "00")
|
|
||||||
// putString("seconds", "00")
|
|
||||||
//}
|
|
||||||
//reactApplicationContext
|
|
||||||
// .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
||||||
// .emit("tick", params)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
fun timer(milliseconds: Int) {
|
||||||
fun timer(milliseconds: Long) {
|
|
||||||
context.registerReceiver(stopReceiver, IntentFilter(STOP_BROADCAST))
|
context.registerReceiver(stopReceiver, IntentFilter(STOP_BROADCAST))
|
||||||
context.registerReceiver(addReceiver, IntentFilter(ADD_BROADCAST))
|
context.registerReceiver(addReceiver, IntentFilter(ADD_BROADCAST))
|
||||||
Log.d("AlarmModule", "Queue alarm for $milliseconds delay")
|
Log.d("MainActivity", "Queue alarm for $milliseconds delay")
|
||||||
//val manager = getManager()
|
val manager = getManager()
|
||||||
//manager.cancel(AlarmService.NOTIFICATION_ID_DONE)
|
manager.cancel(AlarmService.NOTIFICATION_ID_DONE)
|
||||||
//val intent = Intent(reactApplicationContext, AlarmService::class.java)
|
val intent = Intent(context, AlarmService::class.java)
|
||||||
//reactApplicationContext.stopService(intent)
|
context.stopService(intent)
|
||||||
countdownTimer?.cancel()
|
countdownTimer?.cancel()
|
||||||
countdownTimer = getTimer(milliseconds)
|
countdownTimer = getTimer(milliseconds)
|
||||||
countdownTimer?.start()
|
countdownTimer?.start()
|
||||||
running = true
|
running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.M)
|
|
||||||
private fun getTimer(
|
private fun getTimer(
|
||||||
endMs: Long,
|
endMs: Int,
|
||||||
): CountDownTimer {
|
): CountDownTimer {
|
||||||
val builder = getBuilder()
|
val builder = getBuilder()
|
||||||
return object : CountDownTimer(endMs.toLong(), 1000) {
|
return object : CountDownTimer(endMs.toLong(), 1000) {
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun onTick(current: Long) {
|
override fun onTick(current: Long) {
|
||||||
currentMs = current
|
currentMs = current
|
||||||
val seconds =
|
val seconds =
|
||||||
@@ -123,33 +107,18 @@ class MainActivity : FlutterActivity() {
|
|||||||
.setCategory(NotificationCompat.CATEGORY_PROGRESS).priority =
|
.setCategory(NotificationCompat.CATEGORY_PROGRESS).priority =
|
||||||
NotificationCompat.PRIORITY_LOW
|
NotificationCompat.PRIORITY_LOW
|
||||||
val manager = getManager()
|
val manager = getManager()
|
||||||
Log.d("AlarmModule", "Notify $NOTIFICATION_ID_PENDING")
|
Log.d("MainActivity", "current=$current")
|
||||||
manager.notify(NOTIFICATION_ID_PENDING, builder.build())
|
manager.notify(NOTIFICATION_ID_PENDING, builder.build())
|
||||||
//val params = Arguments.createMap().apply {
|
|
||||||
// putString("minutes", minutes)
|
|
||||||
// putString("seconds", seconds)
|
|
||||||
//}
|
|
||||||
//reactApplicationContext
|
|
||||||
// .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
||||||
// .emit("tick", params)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun onFinish() {
|
override fun onFinish() {
|
||||||
//val context = reactApplicationContext
|
Log.d("MainActivity", "Finish")
|
||||||
//context.startForegroundService(Intent(context, AlarmService::class.java))
|
context.startForegroundService(Intent(context, AlarmService::class.java))
|
||||||
//context
|
|
||||||
// .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
||||||
// .emit("finish", Arguments.createMap().apply {
|
|
||||||
// putString("minutes", "00")
|
|
||||||
// putString("seconds", "00")
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("UnspecifiedImmutableFlag")
|
@SuppressLint("UnspecifiedImmutableFlag")
|
||||||
@RequiresApi(Build.VERSION_CODES.M)
|
|
||||||
private fun getBuilder(): NotificationCompat.Builder {
|
private fun getBuilder(): NotificationCompat.Builder {
|
||||||
val contentIntent = Intent(context, MainActivity::class.java)
|
val contentIntent = Intent(context, MainActivity::class.java)
|
||||||
val pendingContent =
|
val pendingContent =
|
||||||
@@ -164,14 +133,13 @@ class MainActivity : FlutterActivity() {
|
|||||||
val pendingStop =
|
val pendingStop =
|
||||||
PendingIntent.getBroadcast(context, 0, stopBroadcast, PendingIntent.FLAG_IMMUTABLE)
|
PendingIntent.getBroadcast(context, 0, stopBroadcast, PendingIntent.FLAG_IMMUTABLE)
|
||||||
return NotificationCompat.Builder(context, CHANNEL_ID_PENDING)
|
return NotificationCompat.Builder(context, CHANNEL_ID_PENDING)
|
||||||
.setSmallIcon(R.drawable.ic_baseline_hourglass_bottom_24).setContentTitle("Resting")
|
.setSmallIcon(R.drawable.baseline_hourglass_bottom_24).setContentTitle("Resting")
|
||||||
.setContentIntent(pendingContent)
|
.setContentIntent(pendingContent)
|
||||||
.addAction(R.drawable.ic_baseline_stop_24, "Stop", pendingStop)
|
.addAction(R.drawable.baseline_hourglass_bottom_24, "Stop", pendingStop)
|
||||||
.addAction(R.drawable.ic_baseline_stop_24, "Add 1 min", pendingAdd)
|
.addAction(R.drawable.baseline_hourglass_bottom_24, "Add 1 min", pendingAdd)
|
||||||
.setDeleteIntent(pendingStop)
|
.setDeleteIntent(pendingStop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
private fun getManager(): NotificationManager {
|
private fun getManager(): NotificationManager {
|
||||||
val notificationManager = context.getSystemService(
|
val notificationManager = context.getSystemService(
|
||||||
NotificationManager::class.java
|
NotificationManager::class.java
|
||||||
@@ -190,5 +158,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
const val ADD_BROADCAST = "add-timer-event"
|
const val ADD_BROADCAST = "add-timer-event"
|
||||||
const val CHANNEL_ID_PENDING = "Timer"
|
const val CHANNEL_ID_PENDING = "Timer"
|
||||||
const val NOTIFICATION_ID_PENDING = 1
|
const val NOTIFICATION_ID_PENDING = 1
|
||||||
|
const val FLUTTER_CHANNEL = "com.massive/android"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package com.example.fmassive
|
||||||
|
|
||||||
|
class Settings(val sound: String?, val noSound: Boolean, val vibrate: Boolean)
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.example.fmassive
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
|
||||||
|
class StopAlarm : Activity() {
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O_MR1)
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
Log.d("AlarmActivity", "Call to AlarmActivity")
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val context = applicationContext
|
||||||
|
context.stopService(Intent(context, AlarmService::class.java))
|
||||||
|
savedInstanceState.apply { setShowWhenLocked(true) }
|
||||||
|
val intent = Intent(context, MainActivity::class.java)
|
||||||
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
context.startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#000000"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M18,22l-0.01,-6L14,12l3.99,-4.01L18,2H6v6l4,4l-4,3.99V22H18zM8,7.5V4h8v3.5l-4,4L8,7.5z"/>
|
||||||
|
</vector>
|
||||||
Binary file not shown.
@@ -26,6 +26,6 @@ subprojects {
|
|||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
dart run build_runner build --delete-conflicting-outputs
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const List<String> weekdayNames = [
|
||||||
|
'Monday',
|
||||||
|
'Tuesday',
|
||||||
|
'Wednesday',
|
||||||
|
'Thursday',
|
||||||
|
'Friday',
|
||||||
|
'Saturday',
|
||||||
|
'Sunday',
|
||||||
|
];
|
||||||
+12
-8
@@ -1,15 +1,18 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:fmassive/gym_set.dart';
|
import 'package:fmassive/gym_sets.dart';
|
||||||
|
import 'package:fmassive/main.dart';
|
||||||
|
import 'package:fmassive/plans.dart';
|
||||||
import 'package:moor/ffi.dart';
|
import 'package:moor/ffi.dart';
|
||||||
import 'package:moor/moor.dart';
|
import 'package:moor/moor.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
|
||||||
import 'settings.dart';
|
import 'settings.dart';
|
||||||
|
|
||||||
part 'database.g.dart';
|
part 'database.g.dart';
|
||||||
|
|
||||||
@UseMoor(tables: [Settings, GymSets])
|
@UseMoor(tables: [Settings, GymSets, Plans])
|
||||||
class MyDatabase extends _$MyDatabase {
|
class MyDatabase extends _$MyDatabase {
|
||||||
MyDatabase() : super(_openConnection());
|
MyDatabase() : super(_openConnection());
|
||||||
|
|
||||||
@@ -19,18 +22,19 @@ class MyDatabase extends _$MyDatabase {
|
|||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
onCreate: (Migrator m) async {
|
onCreate: (Migrator m) async {
|
||||||
|
print('Creating...');
|
||||||
await m.createAll();
|
await m.createAll();
|
||||||
|
var data = await (db.select(db.settings)..limit(1)).get();
|
||||||
|
if (data.isEmpty) await db.into(db.settings).insert(defaultSettings);
|
||||||
},
|
},
|
||||||
onUpgrade: (Migrator m, int from, int to) async {
|
onUpgrade: (Migrator m, int from, int to) async {},
|
||||||
// no migrations yet
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyDatabase _openConnection() {
|
LazyDatabase _openConnection() {
|
||||||
return LazyDatabase(() async {
|
return LazyDatabase(() async {
|
||||||
final dbFolder = await getApplicationDocumentsDirectory();
|
final dbFolder = await getDatabasesPath();
|
||||||
final file = File(join(dbFolder.path, 'massive.db'));
|
final file = File(join(dbFolder, 'massive.db'));
|
||||||
return VmDatabase(file, logStatements: true);
|
return VmDatabase(file, logStatements: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+713
-499
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fmassive/main.dart';
|
||||||
|
import 'package:moor/moor.dart';
|
||||||
|
|
||||||
|
class DeleteAllSets extends StatelessWidget {
|
||||||
|
const DeleteAllSets({
|
||||||
|
super.key,
|
||||||
|
required this.mounted,
|
||||||
|
});
|
||||||
|
|
||||||
|
final bool mounted;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: ElevatedButton(
|
||||||
|
child: const Text("Delete all sets"),
|
||||||
|
onPressed: () async {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text("Delete all sets"),
|
||||||
|
content: const Text(
|
||||||
|
"This will irreversibly destroy all your gym set data. Are you sure?",),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('Cancel'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('Delete'),
|
||||||
|
onPressed: () async {
|
||||||
|
await db.gymSets.delete().go();
|
||||||
|
if (!mounted) return;
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Deleted all sets')),);
|
||||||
|
final navigator = Navigator.of(context);
|
||||||
|
navigator.pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DynamicColorScheme extends StatefulWidget {
|
||||||
|
final Color Function(Brightness brightness) data;
|
||||||
|
final Widget Function(BuildContext context, ColorScheme colorScheme) builder;
|
||||||
|
|
||||||
|
const DynamicColorScheme({
|
||||||
|
required this.data,
|
||||||
|
required this.builder,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
createState() => _DynamicColorSchemeState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DynamicColorSchemeState extends State<DynamicColorScheme> {
|
||||||
|
late final ValueNotifier<Brightness> brightness;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
brightness = ValueNotifier(MediaQuery.of(context).platformBrightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
brightness.value = MediaQuery.of(context).platformBrightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ValueListenableBuilder<Brightness>(
|
||||||
|
valueListenable: brightness,
|
||||||
|
builder: (context, platformBrightness, child) {
|
||||||
|
final colorScheme = ColorScheme.fromSwatch(
|
||||||
|
brightness: platformBrightness,
|
||||||
|
primarySwatch: Colors.blue,
|
||||||
|
accentColor: Colors.blueAccent,
|
||||||
|
).copyWith(
|
||||||
|
secondary: Colors.red,
|
||||||
|
);
|
||||||
|
final color = widget.data(platformBrightness);
|
||||||
|
return widget.builder(
|
||||||
|
context,
|
||||||
|
colorScheme.copyWith(
|
||||||
|
primary: color,
|
||||||
|
),);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/material.dart' as material;
|
||||||
|
import 'package:fmassive/constants.dart';
|
||||||
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/main.dart';
|
||||||
|
import 'package:moor_flutter/moor_flutter.dart';
|
||||||
|
|
||||||
|
class EditPlanPage extends StatefulWidget {
|
||||||
|
final PlansCompanion plan;
|
||||||
|
|
||||||
|
const EditPlanPage({required this.plan, super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
createState() => _EditPlanPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EditPlanPageState extends State<EditPlanPage> {
|
||||||
|
List<String?> names = [];
|
||||||
|
List<bool>? daySelections;
|
||||||
|
List<bool>? exerciseSelections;
|
||||||
|
|
||||||
|
Future<List<String?>> getDistinctNames() async {
|
||||||
|
final names = await (db.gymSets.selectOnly(distinct: true)
|
||||||
|
..addColumns([db.gymSets.name]))
|
||||||
|
.get();
|
||||||
|
return names.map((name) => name.read(db.gymSets.name)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
final dayList = widget.plan.days.value.split(',');
|
||||||
|
daySelections = weekdayNames.map((day) => dayList.contains(day)).toList();
|
||||||
|
|
||||||
|
getDistinctNames().then((value) {
|
||||||
|
setState(() {
|
||||||
|
names = value;
|
||||||
|
final exercises = widget.plan.exercises.value.split(',');
|
||||||
|
exerciseSelections =
|
||||||
|
names.map((name) => exercises.contains(name)).toList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool?> _showConfirmationDialog(BuildContext context) {
|
||||||
|
return showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Confirm Delete'),
|
||||||
|
content: const Text('Are you sure you want to delete this plan?'),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('Yes'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, true); // showDialog() returns true
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('No'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, false); // showDialog() returns false
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
List<Widget> actions = [];
|
||||||
|
if (widget.plan.id.present)
|
||||||
|
actions.add(
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
bool? confirm = await _showConfirmationDialog(context);
|
||||||
|
if (!confirm!) return;
|
||||||
|
await db.plans.deleteOne(widget.plan);
|
||||||
|
if (!mounted) return;
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.delete),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(title: const Text('Edit Plan'), actions: actions),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: material.Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: getChildren,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () async {
|
||||||
|
final days = [];
|
||||||
|
for (int i = 0; i < daySelections!.length; i++) {
|
||||||
|
if (daySelections![i]) days.add(weekdayNames[i]);
|
||||||
|
}
|
||||||
|
if (days.isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Select days first')),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final exercises = [];
|
||||||
|
for (int i = 0; i < exerciseSelections!.length; i++) {
|
||||||
|
if (exerciseSelections![i]) exercises.add(names[i]);
|
||||||
|
}
|
||||||
|
if (exercises.isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Select exercises first')),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newPlan = widget.plan.copyWith(
|
||||||
|
days: Value(days.join(',')),
|
||||||
|
exercises: Value(exercises.join(',')),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (widget.plan.id.present)
|
||||||
|
await db.update(db.plans).replace(newPlan);
|
||||||
|
else {
|
||||||
|
final id = await db.into(db.plans).insert(newPlan);
|
||||||
|
newPlan = newPlan.copyWith(id: Value(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mounted) return;
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.check),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> get getChildren {
|
||||||
|
final List<Widget> children = [
|
||||||
|
Text('Days', style: Theme.of(context).textTheme.headlineSmall),
|
||||||
|
];
|
||||||
|
|
||||||
|
final days = List.generate(7, (index) {
|
||||||
|
return SwitchListTile(
|
||||||
|
title: Text(weekdayNames[index]),
|
||||||
|
value: daySelections![index],
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
daySelections![index] = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
final exercises = List.generate(names.length, (index) {
|
||||||
|
return SwitchListTile(
|
||||||
|
title: Text(names[index] ?? ''),
|
||||||
|
value: exerciseSelections![index],
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
exerciseSelections![index] = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
children.addAll(days);
|
||||||
|
children.add(
|
||||||
|
Text('Exercises', style: Theme.of(context).textTheme.headlineSmall),
|
||||||
|
);
|
||||||
|
children.addAll(exercises);
|
||||||
|
|
||||||
|
return [
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
children: children,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+53
-8
@@ -1,8 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/material.dart' as material;
|
import 'package:flutter/material.dart' as material;
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:fmassive/database.dart';
|
import 'package:fmassive/database.dart';
|
||||||
import 'package:fmassive/main.dart';
|
import 'package:fmassive/main.dart';
|
||||||
import 'package:moor_flutter/moor_flutter.dart';
|
import 'package:moor_flutter/moor_flutter.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
class EditGymSetPage extends StatefulWidget {
|
class EditGymSetPage extends StatefulWidget {
|
||||||
final GymSetsCompanion gymSet;
|
final GymSetsCompanion gymSet;
|
||||||
@@ -18,14 +20,30 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
|||||||
final TextEditingController _repsController = TextEditingController();
|
final TextEditingController _repsController = TextEditingController();
|
||||||
final TextEditingController _weightController = TextEditingController();
|
final TextEditingController _weightController = TextEditingController();
|
||||||
late GymSetsCompanion gymSet;
|
late GymSetsCompanion gymSet;
|
||||||
|
final nameNode = FocusNode();
|
||||||
|
final repsNode = FocusNode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
gymSet = widget.gymSet;
|
gymSet = widget.gymSet;
|
||||||
|
print(gymSet);
|
||||||
_nameController.text = gymSet.name.value;
|
_nameController.text = gymSet.name.value;
|
||||||
_repsController.text = gymSet.reps.value.toString();
|
_repsController.text = gymSet.reps.value.toString();
|
||||||
_weightController.text = gymSet.weight.value.toString();
|
_weightController.text = gymSet.weight.value.toString();
|
||||||
|
if (gymSet.id.present) {
|
||||||
|
repsNode.requestFocus();
|
||||||
|
_repsController.selection = TextSelection(
|
||||||
|
baseOffset: 0, extentOffset: _repsController.text.length,);
|
||||||
|
} else
|
||||||
|
nameNode.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
dispose() {
|
||||||
|
nameNode.dispose();
|
||||||
|
repsNode.dispose();
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -38,9 +56,10 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
|||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.delete)));
|
icon: const Icon(Icons.delete),),);
|
||||||
|
|
||||||
return Scaffold(
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
appBar: AppBar(title: const Text('Edit Gym Set'), actions: actions),
|
appBar: AppBar(title: const Text('Edit Gym Set'), actions: actions),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
@@ -49,7 +68,12 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
|||||||
children: [
|
children: [
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _nameController,
|
controller: _nameController,
|
||||||
|
focusNode: nameNode,
|
||||||
decoration: const InputDecoration(labelText: 'Name'),
|
decoration: const InputDecoration(labelText: 'Name'),
|
||||||
|
onTap: () {
|
||||||
|
_nameController.selection = TextSelection(
|
||||||
|
baseOffset: 0, extentOffset: _nameController.text.length,);
|
||||||
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
gymSet = gymSet.copyWith(name: Value(value));
|
gymSet = gymSet.copyWith(name: Value(value));
|
||||||
@@ -58,6 +82,11 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
|||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _repsController,
|
controller: _repsController,
|
||||||
|
focusNode: repsNode,
|
||||||
|
onTap: () {
|
||||||
|
_repsController.selection = TextSelection(
|
||||||
|
baseOffset: 0, extentOffset: _repsController.text.length,);
|
||||||
|
},
|
||||||
decoration: const InputDecoration(labelText: 'Reps'),
|
decoration: const InputDecoration(labelText: 'Reps'),
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
@@ -71,10 +100,14 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
|||||||
controller: _weightController,
|
controller: _weightController,
|
||||||
decoration: const InputDecoration(labelText: 'Weight (kg)'),
|
decoration: const InputDecoration(labelText: 'Weight (kg)'),
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
|
onTap: () {
|
||||||
|
_weightController.selection = TextSelection(
|
||||||
|
baseOffset: 0, extentOffset: _weightController.text.length,);
|
||||||
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
gymSet =
|
gymSet = gymSet.copyWith(
|
||||||
gymSet.copyWith(weight: Value(int.tryParse(value) ?? 0));
|
weight: Value(double.tryParse(value) ?? 0),);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -83,15 +116,27 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
|||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
if (_nameController.text.isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Please enter a name')),);
|
||||||
|
nameNode.requestFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (gymSet.id.present)
|
if (gymSet.id.present)
|
||||||
await db.update(db.gymSets).write(gymSet);
|
await db.update(db.gymSets).replace(gymSet);
|
||||||
else
|
else {
|
||||||
await db.into(db.gymSets).insert(gymSet);
|
await Permission.notification.request();
|
||||||
|
final newSet = gymSet.copyWith(
|
||||||
|
created: Value(DateTime.now().toIso8601String()),);
|
||||||
|
await db.into(db.gymSets).insert(newSet);
|
||||||
|
const platform = MethodChannel('com.massive/android');
|
||||||
|
platform.invokeMethod('timer', [3000]);
|
||||||
|
}
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.check),
|
child: const Icon(Icons.check),
|
||||||
),
|
),
|
||||||
);
|
),);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ class GymSets extends Table {
|
|||||||
IntColumn get id => integer().autoIncrement()();
|
IntColumn get id => integer().autoIncrement()();
|
||||||
TextColumn get name => text()();
|
TextColumn get name => text()();
|
||||||
IntColumn get reps => integer()();
|
IntColumn get reps => integer()();
|
||||||
IntColumn get weight => integer()();
|
RealColumn get weight => real()();
|
||||||
IntColumn get sets => integer().withDefault(const Constant(3))();
|
IntColumn get sets => integer().withDefault(const Constant(3))();
|
||||||
IntColumn get minutes => integer().withDefault(const Constant(3))();
|
IntColumn get minutes => integer().withDefault(const Constant(3))();
|
||||||
IntColumn get seconds => integer().withDefault(const Constant(30))();
|
IntColumn get seconds => integer().withDefault(const Constant(30))();
|
||||||
BoolColumn get hidden => boolean().withDefault(const Constant(false))();
|
BoolColumn get hidden =>
|
||||||
|
boolean().nullable().withDefault(const Constant(false))();
|
||||||
TextColumn get created => text()();
|
TextColumn get created => text()();
|
||||||
TextColumn get unit => text().withDefault(const Constant('kg'))();
|
TextColumn get unit => text().withDefault(const Constant('kg'))();
|
||||||
TextColumn get image => text()();
|
TextColumn get image => text().nullable()();
|
||||||
TextColumn get steps => text().nullable()();
|
TextColumn get steps => text().nullable()();
|
||||||
}
|
}
|
||||||
+11
-96
@@ -1,22 +1,19 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:fmassive/best_page.dart';
|
import 'package:fmassive/best_page.dart';
|
||||||
import 'package:fmassive/database.dart';
|
|
||||||
import 'package:fmassive/edit_set.dart';
|
|
||||||
import 'package:fmassive/main.dart';
|
|
||||||
import 'package:fmassive/plans_page.dart';
|
import 'package:fmassive/plans_page.dart';
|
||||||
|
import 'package:fmassive/set_list.dart';
|
||||||
import 'package:fmassive/settings_page.dart';
|
import 'package:fmassive/settings_page.dart';
|
||||||
import 'package:fmassive/timer_page.dart';
|
import 'package:fmassive/timer_page.dart';
|
||||||
import 'package:fmassive/workouts_page.dart';
|
import 'package:fmassive/workouts_page.dart';
|
||||||
import 'package:moor_flutter/moor_flutter.dart';
|
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({super.key});
|
const HomePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
createState() => RootPage();
|
createState() => _HomePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
class RootPage extends State<HomePage> {
|
class _HomePage extends State<HomePage> {
|
||||||
bool showSearch = false;
|
bool showSearch = false;
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
String search = '';
|
String search = '';
|
||||||
@@ -33,6 +30,7 @@ class RootPage extends State<HomePage> {
|
|||||||
|
|
||||||
void toggleSearch() {
|
void toggleSearch() {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
if (showSearch) search = '';
|
||||||
showSearch = !showSearch;
|
showSearch = !showSearch;
|
||||||
});
|
});
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
@@ -41,7 +39,7 @@ class RootPage extends State<HomePage> {
|
|||||||
Widget getBody() {
|
Widget getBody() {
|
||||||
switch (routes[selected]['title']) {
|
switch (routes[selected]['title']) {
|
||||||
case 'Settings':
|
case 'Settings':
|
||||||
return const SettingsPage();
|
return SettingsPage(search: search);
|
||||||
case 'Timer':
|
case 'Timer':
|
||||||
return const TimerPage();
|
return const TimerPage();
|
||||||
case 'Workouts':
|
case 'Workouts':
|
||||||
@@ -49,15 +47,17 @@ class RootPage extends State<HomePage> {
|
|||||||
case 'Best':
|
case 'Best':
|
||||||
return const BestPage();
|
return const BestPage();
|
||||||
case 'Plans':
|
case 'Plans':
|
||||||
return const PlansPage();
|
return PlansPage(search: search);
|
||||||
default:
|
default:
|
||||||
return _HomePageWidget(search: search);
|
return SetList(search: search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
drawerEdgeDragWidth: 200.0,
|
||||||
drawer: Drawer(
|
drawer: Drawer(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: routes.length,
|
itemCount: routes.length,
|
||||||
@@ -101,91 +101,6 @@ class RootPage extends State<HomePage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: getBody(),
|
body: getBody(),
|
||||||
);
|
),);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _HomePageWidget extends StatefulWidget {
|
|
||||||
final String search;
|
|
||||||
|
|
||||||
const _HomePageWidget({Key? key, required this.search}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
createState() => _HomePage();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _HomePage extends State<_HomePageWidget> {
|
|
||||||
bool showSearch = false;
|
|
||||||
late Stream<List<GymSet>> stream;
|
|
||||||
|
|
||||||
@override
|
|
||||||
initState() {
|
|
||||||
super.initState();
|
|
||||||
setStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setStream() {
|
|
||||||
stream = (db.select(db.gymSets)
|
|
||||||
..where((gymSet) => gymSet.name.contains(widget.search))
|
|
||||||
..limit(10, offset: 0))
|
|
||||||
.watch();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
didUpdateWidget(covariant _HomePageWidget oldWidget) {
|
|
||||||
super.didUpdateWidget(oldWidget);
|
|
||||||
setStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleSearch() {
|
|
||||||
setState(() {
|
|
||||||
showSearch = !showSearch;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
body: StreamBuilder<List<GymSet>>(
|
|
||||||
stream: stream,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
final gymSets = snapshot.data;
|
|
||||||
|
|
||||||
if (gymSets == null)
|
|
||||||
return const Center(child: CircularProgressIndicator());
|
|
||||||
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: gymSets.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return ListTile(
|
|
||||||
title: Text(gymSets[index].name),
|
|
||||||
onTap: () async {
|
|
||||||
await Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => EditGymSetPage(
|
|
||||||
gymSet: gymSets[index].toCompanion(false)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
|
||||||
onPressed: () async {
|
|
||||||
await Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => EditGymSetPage(
|
|
||||||
gymSet: GymSetsCompanion(
|
|
||||||
name: const Value(''),
|
|
||||||
reps: const Value(0),
|
|
||||||
weight: const Value(0),
|
|
||||||
image: const Value(''),
|
|
||||||
created: Value(DateTime.now().toString()))),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: const Icon(Icons.add)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-16
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:fmassive/database.dart';
|
import 'package:fmassive/database.dart';
|
||||||
import 'package:fmassive/edit_set.dart';
|
|
||||||
import 'package:fmassive/home_page.dart';
|
import 'package:fmassive/home_page.dart';
|
||||||
|
|
||||||
MyDatabase db = MyDatabase();
|
MyDatabase db = MyDatabase();
|
||||||
@@ -10,27 +9,18 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
MyApp({Key? key}) : super(key: key);
|
MyApp({super.key});
|
||||||
|
|
||||||
final navigatorKey = GlobalKey<NavigatorState>();
|
final navigatorKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
const edit = EditGymSetPage(gymSet: GymSetsCompanion());
|
|
||||||
|
|
||||||
final Map<String, WidgetBuilder> routes = {
|
|
||||||
'/home': (context) => const HomePage(),
|
|
||||||
'/edit-set': (context) => edit,
|
|
||||||
};
|
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Gym App',
|
title: 'Massive',
|
||||||
theme: ThemeData(
|
themeMode: ThemeMode.system,
|
||||||
primarySwatch: Colors.blue,
|
home: const HomePage(),
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
darkTheme: ThemeData.dark(),
|
||||||
),
|
theme: ThemeData.light(),
|
||||||
initialRoute: '/home',
|
|
||||||
routes: routes,
|
|
||||||
navigatorKey: navigatorKey,
|
navigatorKey: navigatorKey,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fmassive/constants.dart';
|
||||||
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/plan_tile.dart';
|
||||||
|
|
||||||
|
class PlanList extends StatelessWidget {
|
||||||
|
const PlanList({
|
||||||
|
super.key,
|
||||||
|
required this.plans,
|
||||||
|
});
|
||||||
|
|
||||||
|
final List<Plan> plans;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final weekday = weekdayNames[DateTime.now().weekday - 1];
|
||||||
|
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: plans.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return PlanTile(plan: plans[index], weekday: weekday);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/edit_plan.dart';
|
||||||
|
import 'package:fmassive/main.dart';
|
||||||
|
import 'package:fmassive/start_plan.dart';
|
||||||
|
import 'package:moor_flutter/moor_flutter.dart';
|
||||||
|
|
||||||
|
class PlanTile extends StatelessWidget {
|
||||||
|
PlanTile({
|
||||||
|
super.key,
|
||||||
|
required this.plan,
|
||||||
|
required this.weekday,
|
||||||
|
});
|
||||||
|
|
||||||
|
final Plan plan;
|
||||||
|
final String weekday;
|
||||||
|
final tapPosition = GlobalKey();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MenuAnchor(
|
||||||
|
menuChildren: [
|
||||||
|
MenuItemButton(
|
||||||
|
child: const Text("Edit"),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
EditPlanPage(plan: plan.toCompanion(false)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
MenuItemButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await db.plans.deleteOne(plan);
|
||||||
|
},
|
||||||
|
child: const Text("Delete"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
builder: (context, controller, child) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(
|
||||||
|
plan.days.replaceAll(',', ', '),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: plan.days.contains(weekday) ? FontWeight.bold : null,
|
||||||
|
decoration:
|
||||||
|
plan.days.contains(weekday) ? TextDecoration.underline : null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Text(plan.exercises),
|
||||||
|
onLongPress: () {
|
||||||
|
controller.open();
|
||||||
|
},
|
||||||
|
onTap: () async {
|
||||||
|
await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => StartPlan(plan: plan.toCompanion(false)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import 'package:moor/moor.dart';
|
||||||
|
|
||||||
|
class Plans extends Table {
|
||||||
|
IntColumn get id => integer().autoIncrement()();
|
||||||
|
TextColumn get days => text()();
|
||||||
|
TextColumn get exercises => text()();
|
||||||
|
}
|
||||||
+60
-127
@@ -1,163 +1,96 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/material.dart' as material;
|
|
||||||
import 'package:fmassive/database.dart';
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/edit_plan.dart';
|
||||||
import 'package:fmassive/main.dart';
|
import 'package:fmassive/main.dart';
|
||||||
import 'package:fmassive/settings.dart';
|
import 'package:fmassive/plan_list.dart';
|
||||||
import 'package:moor/moor.dart';
|
import 'package:moor/moor.dart';
|
||||||
|
|
||||||
class PlansPage extends StatelessWidget {
|
class PlansPage extends StatelessWidget {
|
||||||
const PlansPage({super.key});
|
const PlansPage({super.key, required this.search});
|
||||||
|
|
||||||
|
final String search;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: _PlansPage(),
|
child: _PlansPage(search: search),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PlansPage extends StatefulWidget {
|
class _PlansPage extends StatefulWidget {
|
||||||
const _PlansPage({Key? key}) : super(key: key);
|
const _PlansPage({required this.search});
|
||||||
|
|
||||||
|
final String search;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
createState() => _PlansPageState();
|
createState() => _PlansPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PlansPageState extends State<_PlansPage> {
|
class _PlansPageState extends State<_PlansPage> {
|
||||||
late Stream<Setting> stream;
|
bool showSearch = false;
|
||||||
|
late Stream<List<Plan>> stream;
|
||||||
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
@override
|
||||||
|
initState() {
|
||||||
|
super.initState();
|
||||||
|
setStream();
|
||||||
|
}
|
||||||
|
|
||||||
void reset() async {
|
void setStream() {
|
||||||
var data = await db.select(db.settings).get();
|
stream = (db.select(db.plans)
|
||||||
if (data.isEmpty) await db.into(db.settings).insert(defaultSettings);
|
..where((gymSet) => gymSet.days.contains(widget.search))
|
||||||
setState(() {
|
..limit(10, offset: 0))
|
||||||
if (data.isEmpty) return;
|
.watch();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
didUpdateWidget(covariant _PlansPage oldWidget) {
|
||||||
super.initState();
|
super.didUpdateWidget(oldWidget);
|
||||||
stream = db.select(db.settings).watchSingle();
|
setStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleSearch() {
|
||||||
|
setState(() {
|
||||||
|
showSearch = !showSearch;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: StreamBuilder<Setting>(
|
body: StreamBuilder<List<Plan>>(
|
||||||
stream: stream,
|
stream: stream,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final settings = snapshot.data;
|
final plans = snapshot.data;
|
||||||
|
|
||||||
if (settings == null)
|
if (snapshot.hasError)
|
||||||
return const Center(child: CircularProgressIndicator());
|
return Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Text(
|
||||||
|
'Error: ${snapshot.error}',
|
||||||
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
|
),),
|
||||||
|
);
|
||||||
|
|
||||||
return SingleChildScrollView(
|
if (plans == null) return Container();
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: material.Column(
|
return PlanList(plans: plans);
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
},),
|
||||||
children: [
|
floatingActionButton: FloatingActionButton(
|
||||||
SwitchListTile(
|
onPressed: () async {
|
||||||
title: const Text('Alarm'),
|
await Navigator.push(
|
||||||
value: settings.alarm,
|
context,
|
||||||
onChanged: (value) {
|
MaterialPageRoute(
|
||||||
db
|
builder: (context) => const EditPlanPage(
|
||||||
.update(db.settings)
|
plan: PlansCompanion(
|
||||||
.write(SettingsCompanion(alarm: Value(value)));
|
days: Value(''), exercises: Value(''),),),
|
||||||
},
|
),
|
||||||
),
|
);
|
||||||
SwitchListTile(
|
},
|
||||||
title: const Text('Vibrate'),
|
child: const Icon(Icons.add),),);
|
||||||
value: settings.vibrate,
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(vibrate: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SwitchListTile(
|
|
||||||
title: const Text('Notify'),
|
|
||||||
value: settings.notify,
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(notify: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SwitchListTile(
|
|
||||||
title: const Text('Images'),
|
|
||||||
value: settings.images,
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(images: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SwitchListTile(
|
|
||||||
title: const Text('Show Unit'),
|
|
||||||
value: settings.showUnit,
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(showUnit: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SwitchListTile(
|
|
||||||
title: const Text('Steps'),
|
|
||||||
value: settings.steps,
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(steps: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Sound',
|
|
||||||
),
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(sound: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Light Color',
|
|
||||||
),
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(lightColor: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Dark Color',
|
|
||||||
),
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(darkColor: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Date',
|
|
||||||
),
|
|
||||||
onChanged: (value) {
|
|
||||||
db
|
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(date: Value(value)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/edit_set.dart';
|
||||||
|
import 'package:fmassive/main.dart';
|
||||||
|
import 'package:fmassive/set_tile.dart';
|
||||||
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
|
import 'package:moor_flutter/moor_flutter.dart';
|
||||||
|
|
||||||
|
class SetList extends StatefulWidget {
|
||||||
|
final String search;
|
||||||
|
|
||||||
|
const SetList({super.key, required this.search});
|
||||||
|
|
||||||
|
@override
|
||||||
|
createState() => _SetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SetList extends State<SetList> {
|
||||||
|
bool showSearch = false;
|
||||||
|
final PagingController<int, GymSet> pagingController =
|
||||||
|
PagingController(firstPageKey: 0);
|
||||||
|
|
||||||
|
@override
|
||||||
|
initState() {
|
||||||
|
super.initState();
|
||||||
|
pagingController.addPageRequestListener((pageKey) {
|
||||||
|
fetch(pageKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
didUpdateWidget(covariant SetList oldWidget) {
|
||||||
|
super.didUpdateWidget(oldWidget);
|
||||||
|
pagingController.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> fetch(int pageKey) async {
|
||||||
|
final gymSets = await (db.select(db.gymSets)
|
||||||
|
..where((gymSet) => gymSet.name.contains(widget.search))
|
||||||
|
..orderBy([
|
||||||
|
(u) => OrderingTerm(expression: u.created, mode: OrderingMode.desc),
|
||||||
|
])
|
||||||
|
..limit(10, offset: pageKey * 10))
|
||||||
|
.get();
|
||||||
|
|
||||||
|
final isLastPage = gymSets.length < 10;
|
||||||
|
|
||||||
|
if (isLastPage) {
|
||||||
|
pagingController.appendLastPage(gymSets);
|
||||||
|
} else {
|
||||||
|
final nextPageKey = pageKey + 1;
|
||||||
|
pagingController.appendPage(gymSets, nextPageKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleSearch() {
|
||||||
|
setState(() {
|
||||||
|
showSearch = !showSearch;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: PagedListView<int, GymSet>(
|
||||||
|
pagingController: pagingController,
|
||||||
|
builderDelegate: PagedChildBuilderDelegate<GymSet>(
|
||||||
|
itemBuilder: (context, gymSet, index) => SetTile(
|
||||||
|
pagingController: pagingController,
|
||||||
|
gymSet: gymSet,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const EditGymSetPage(
|
||||||
|
gymSet: GymSetsCompanion(
|
||||||
|
name: Value(''),
|
||||||
|
reps: Value(0),
|
||||||
|
weight: Value(0),
|
||||||
|
image: Value(''),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
pagingController.refresh();
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.add),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/edit_set.dart';
|
||||||
|
import 'package:fmassive/main.dart';
|
||||||
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:moor/moor.dart';
|
||||||
|
|
||||||
|
class SetTile extends StatelessWidget {
|
||||||
|
const SetTile({
|
||||||
|
super.key,
|
||||||
|
required this.pagingController,
|
||||||
|
required this.gymSet,
|
||||||
|
});
|
||||||
|
|
||||||
|
final PagingController<int, GymSet> pagingController;
|
||||||
|
final GymSet gymSet;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(gymSet.name),
|
||||||
|
subtitle: Text(DateFormat("yyyy-MM-dd HH:mm")
|
||||||
|
.format(DateTime.parse(gymSet.created)),),
|
||||||
|
trailing: Text("${gymSet.reps} x ${gymSet.weight}kg"),
|
||||||
|
onTap: () async {
|
||||||
|
await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => EditGymSetPage(
|
||||||
|
gymSet: gymSet.toCompanion(false),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
pagingController.refresh();
|
||||||
|
},
|
||||||
|
onLongPress: () => showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Delete set'),
|
||||||
|
content: Text(
|
||||||
|
'Are you sure you want to delete ${gymSet.name} ${gymSet.reps}x${gymSet.weight}${gymSet.unit}?',),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('Cancel'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('Delete'),
|
||||||
|
onPressed: () async {
|
||||||
|
final navigator = Navigator.of(context);
|
||||||
|
await db.gymSets.deleteOne(gymSet);
|
||||||
|
pagingController.refresh();
|
||||||
|
navigator.pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-14
@@ -4,7 +4,7 @@ import 'package:moor/moor.dart';
|
|||||||
Setting defaultSettings = Setting(
|
Setting defaultSettings = Setting(
|
||||||
alarm: true,
|
alarm: true,
|
||||||
vibrate: true,
|
vibrate: true,
|
||||||
sound: 'default.mp3',
|
sound: null,
|
||||||
notify: true,
|
notify: true,
|
||||||
images: true,
|
images: true,
|
||||||
showUnit: true,
|
showUnit: true,
|
||||||
@@ -21,18 +21,18 @@ Setting defaultSettings = Setting(
|
|||||||
|
|
||||||
class Settings extends Table {
|
class Settings extends Table {
|
||||||
BoolColumn get alarm => boolean()();
|
BoolColumn get alarm => boolean()();
|
||||||
BoolColumn get vibrate => boolean()();
|
BoolColumn get backup => boolean().nullable()();
|
||||||
TextColumn get sound => text()();
|
|
||||||
BoolColumn get notify => boolean()();
|
|
||||||
BoolColumn get images => boolean()();
|
|
||||||
BoolColumn get showUnit => boolean()();
|
|
||||||
TextColumn get lightColor => text().nullable()();
|
|
||||||
TextColumn get darkColor => text().nullable()();
|
TextColumn get darkColor => text().nullable()();
|
||||||
BoolColumn get steps => boolean()();
|
TextColumn get date => text().nullable()();
|
||||||
TextColumn get date => text()();
|
BoolColumn get images => boolean().nullable()();
|
||||||
BoolColumn get showDate => boolean()();
|
TextColumn get lightColor => text().nullable()();
|
||||||
TextColumn get theme => text()();
|
BoolColumn get noSound => boolean().nullable()();
|
||||||
BoolColumn get showSets => boolean()();
|
BoolColumn get notify => boolean().nullable()();
|
||||||
BoolColumn get noSound => boolean()();
|
BoolColumn get showDate => boolean().nullable()();
|
||||||
BoolColumn get backup => boolean()();
|
BoolColumn get showSets => boolean().nullable()();
|
||||||
|
BoolColumn get showUnit => boolean().nullable()();
|
||||||
|
TextColumn get sound => text().nullable()();
|
||||||
|
BoolColumn get steps => boolean().nullable()();
|
||||||
|
TextColumn get theme => text().nullable()();
|
||||||
|
BoolColumn get vibrate => boolean()();
|
||||||
}
|
}
|
||||||
|
|||||||
+142
-121
@@ -1,25 +1,35 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:csv/csv.dart';
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/material.dart' as material;
|
import 'package:flutter/material.dart' as material;
|
||||||
import 'package:fmassive/database.dart';
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/delete_all_sets.dart';
|
||||||
import 'package:fmassive/main.dart';
|
import 'package:fmassive/main.dart';
|
||||||
import 'package:fmassive/settings.dart';
|
import 'package:fmassive/sound_picker.dart';
|
||||||
import 'package:moor/moor.dart';
|
import 'package:moor/moor.dart';
|
||||||
|
|
||||||
class SettingsPage extends StatelessWidget {
|
class SettingsPage extends StatelessWidget {
|
||||||
const SettingsPage({super.key});
|
const SettingsPage({super.key, required this.search});
|
||||||
|
|
||||||
|
final String search;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: _SettingsPage(),
|
child: _SettingsPage(search: search),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SettingsPage extends StatefulWidget {
|
class _SettingsPage extends StatefulWidget {
|
||||||
const _SettingsPage({Key? key}) : super(key: key);
|
const _SettingsPage({required this.search});
|
||||||
|
|
||||||
|
final String search;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
createState() => _SettingsPageState();
|
createState() => _SettingsPageState();
|
||||||
@@ -28,134 +38,145 @@ class _SettingsPage extends StatefulWidget {
|
|||||||
class _SettingsPageState extends State<_SettingsPage> {
|
class _SettingsPageState extends State<_SettingsPage> {
|
||||||
late Stream<Setting> stream;
|
late Stream<Setting> stream;
|
||||||
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
|
||||||
|
|
||||||
void reset() async {
|
|
||||||
var data = await db.select(db.settings).get();
|
|
||||||
if (data.isEmpty) await db.into(db.settings).insert(defaultSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
reset();
|
stream = (db.select(db.settings)..limit(1)).watchSingle();
|
||||||
stream = db.select(db.settings).watchSingle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: StreamBuilder<Setting>(
|
body: StreamBuilder<Setting>(
|
||||||
stream: stream,
|
stream: stream,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final settings = snapshot.data;
|
final settings = snapshot.data;
|
||||||
|
print('build: $settings');
|
||||||
|
|
||||||
if (settings == null)
|
if (settings == null) return Container();
|
||||||
return const Center(child: CircularProgressIndicator());
|
|
||||||
|
|
||||||
return SingleChildScrollView(
|
final filteredItems = [
|
||||||
padding: const EdgeInsets.all(8.0),
|
{'title': 'Alarm', 'value': settings.alarm},
|
||||||
child: material.Column(
|
{'title': 'Vibrate', 'value': settings.vibrate},
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
{'title': 'Notify', 'value': settings.notify},
|
||||||
children: [
|
{'title': 'Images', 'value': settings.images},
|
||||||
SwitchListTile(
|
{'title': 'Show Unit', 'value': settings.showUnit},
|
||||||
title: const Text('Alarm'),
|
{'title': 'Steps', 'value': settings.steps},
|
||||||
value: settings.alarm,
|
{'title': 'Sound', 'value': settings.sound},
|
||||||
onChanged: (value) {
|
{'title': 'Import sets', 'value': null},
|
||||||
db
|
{'title': 'Delete all sets', 'value': null},
|
||||||
.update(db.settings)
|
]
|
||||||
.write(SettingsCompanion(alarm: Value(value)));
|
.where((item) => (item['title'] as String)
|
||||||
},
|
.toLowerCase()
|
||||||
),
|
.contains(widget.search.toLowerCase()),)
|
||||||
SwitchListTile(
|
.toList();
|
||||||
title: const Text('Vibrate'),
|
|
||||||
value: settings.vibrate,
|
return material.Column(
|
||||||
onChanged: (value) {
|
children: [
|
||||||
db
|
Expanded(
|
||||||
.update(db.settings)
|
child: ListView.builder(
|
||||||
.write(SettingsCompanion(vibrate: Value(value)));
|
itemCount: filteredItems.length,
|
||||||
},
|
itemBuilder: (context, index) {
|
||||||
),
|
final item = filteredItems[index];
|
||||||
SwitchListTile(
|
|
||||||
title: const Text('Notify'),
|
if (item['title'] == 'Delete all sets')
|
||||||
value: settings.notify,
|
return DeleteAllSets(mounted: mounted);
|
||||||
onChanged: (value) {
|
|
||||||
db
|
if (item['title'] == 'Import sets')
|
||||||
.update(db.settings)
|
return Center(
|
||||||
.write(SettingsCompanion(notify: Value(value)));
|
child: ElevatedButton(
|
||||||
},
|
child: const Text("Import sets"),
|
||||||
),
|
onPressed: () async {
|
||||||
SwitchListTile(
|
final result = await FilePicker.platform.pickFiles(
|
||||||
title: const Text('Images'),
|
type: FileType.custom,
|
||||||
value: settings.images,
|
allowedExtensions: ['csv'],);
|
||||||
onChanged: (value) {
|
if (result == null) return;
|
||||||
db
|
|
||||||
.update(db.settings)
|
final file = File(result.files.single.path!);
|
||||||
.write(SettingsCompanion(images: Value(value)));
|
final input = file.openRead();
|
||||||
},
|
final fields = await input
|
||||||
),
|
.transform(utf8.decoder)
|
||||||
SwitchListTile(
|
.transform(const CsvToListConverter(eol: "\n"))
|
||||||
title: const Text('Show Unit'),
|
.skip(1)
|
||||||
value: settings.showUnit,
|
.toList();
|
||||||
onChanged: (value) {
|
final gymSets = fields.map((row) => GymSetsCompanion(
|
||||||
db
|
id: Value(int.tryParse(row[0]) ?? 0),
|
||||||
.update(db.settings)
|
name: Value(row[1]),
|
||||||
.write(SettingsCompanion(showUnit: Value(value)));
|
reps: Value(int.tryParse(row[2]) ?? 0),
|
||||||
},
|
weight: Value(double.tryParse(row[3]) ?? 0),
|
||||||
),
|
created: Value(row[4]),
|
||||||
SwitchListTile(
|
unit: Value(row[5]),
|
||||||
title: const Text('Steps'),
|
hidden: Value(row[6] == 'true'),
|
||||||
value: settings.steps,
|
image: Value(row[7]),
|
||||||
onChanged: (value) {
|
sets: Value(int.tryParse(row[8]) ?? 0),
|
||||||
db
|
minutes: Value(int.tryParse(row[9]) ?? 0),
|
||||||
.update(db.settings)
|
seconds: Value(int.tryParse(row[10]) ?? 0),
|
||||||
.write(SettingsCompanion(steps: Value(value)));
|
steps: Value(row[11]),
|
||||||
},
|
),);
|
||||||
),
|
await db.batch(
|
||||||
TextField(
|
(batch) => batch.insertAll(db.gymSets, gymSets),);
|
||||||
decoration: const InputDecoration(
|
if (!mounted) return;
|
||||||
labelText: 'Sound',
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
),
|
const SnackBar(content: Text('Imported sets')),);
|
||||||
onChanged: (value) {
|
},
|
||||||
db
|
),);
|
||||||
.update(db.settings)
|
|
||||||
.write(SettingsCompanion(sound: Value(value)));
|
if (item['title'] == 'Sound') {
|
||||||
},
|
return Center(
|
||||||
),
|
child: SoundPicker(
|
||||||
TextField(
|
path: settings.sound,
|
||||||
decoration: const InputDecoration(
|
onSelect: (path) {
|
||||||
labelText: 'Light Color',
|
db
|
||||||
),
|
.update(db.settings)
|
||||||
onChanged: (value) {
|
.write(SettingsCompanion(sound: Value(path)));
|
||||||
db
|
},
|
||||||
.update(db.settings)
|
),
|
||||||
.write(SettingsCompanion(lightColor: Value(value)));
|
);
|
||||||
},
|
}
|
||||||
),
|
|
||||||
TextField(
|
return SwitchListTile(
|
||||||
decoration: const InputDecoration(
|
title: Text(item['title'].toString()),
|
||||||
labelText: 'Dark Color',
|
value: (item['value'] ?? false) as bool,
|
||||||
),
|
onChanged: (value) {
|
||||||
onChanged: (value) {
|
switch (item['title']) {
|
||||||
db
|
case 'Alarm':
|
||||||
.update(db.settings)
|
db
|
||||||
.write(SettingsCompanion(darkColor: Value(value)));
|
.update(db.settings)
|
||||||
},
|
.write(SettingsCompanion(alarm: Value(value)));
|
||||||
),
|
break;
|
||||||
TextField(
|
case 'Vibrate':
|
||||||
decoration: const InputDecoration(
|
db.update(db.settings).write(
|
||||||
labelText: 'Date',
|
SettingsCompanion(vibrate: Value(value)),);
|
||||||
),
|
break;
|
||||||
onChanged: (value) {
|
case 'Notify':
|
||||||
db
|
db
|
||||||
.update(db.settings)
|
.update(db.settings)
|
||||||
.write(SettingsCompanion(date: Value(value)));
|
.write(SettingsCompanion(notify: Value(value)));
|
||||||
},
|
break;
|
||||||
),
|
case 'Images':
|
||||||
],
|
db
|
||||||
|
.update(db.settings)
|
||||||
|
.write(SettingsCompanion(images: Value(value)));
|
||||||
|
break;
|
||||||
|
case 'Show Unit':
|
||||||
|
db.update(db.settings).write(
|
||||||
|
SettingsCompanion(showUnit: Value(value)),);
|
||||||
|
break;
|
||||||
|
case 'Steps':
|
||||||
|
db
|
||||||
|
.update(db.settings)
|
||||||
|
.write(SettingsCompanion(steps: Value(value)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
],
|
||||||
}),
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:path/path.dart';
|
||||||
|
|
||||||
|
class SoundPicker extends StatefulWidget {
|
||||||
|
const SoundPicker({super.key, required this.onSelect, required this.path});
|
||||||
|
|
||||||
|
final Function(String path) onSelect;
|
||||||
|
final String? path;
|
||||||
|
|
||||||
|
@override
|
||||||
|
createState() => _SoundPickerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SoundPickerState extends State<SoundPicker> {
|
||||||
|
final audioPlayer = AudioPlayer();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
audioPlayer.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||||
|
type: FileType.audio,
|
||||||
|
);
|
||||||
|
if (result == null) return;
|
||||||
|
final path = result.files.first.path;
|
||||||
|
if (path == null) return;
|
||||||
|
await audioPlayer.play(DeviceFileSource(path));
|
||||||
|
widget.onSelect(path);
|
||||||
|
},
|
||||||
|
child: Text(widget.path != null
|
||||||
|
? "Sound: ${basename(widget.path!)}"
|
||||||
|
: 'Alarm sound',),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/material.dart' as material;
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:fmassive/database.dart';
|
||||||
|
import 'package:fmassive/main.dart';
|
||||||
|
import 'package:moor_flutter/moor_flutter.dart';
|
||||||
|
|
||||||
|
class StartPlan extends StatefulWidget {
|
||||||
|
final PlansCompanion plan;
|
||||||
|
|
||||||
|
const StartPlan({required this.plan, super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
createState() => _StartPlanState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StartPlanState extends State<StartPlan> {
|
||||||
|
late List<String> exercises;
|
||||||
|
List<int> counts = [];
|
||||||
|
List<int> totals = [];
|
||||||
|
int selectedExercise = 0;
|
||||||
|
final repsController = TextEditingController();
|
||||||
|
final repsNode = FocusNode();
|
||||||
|
final weightController = TextEditingController();
|
||||||
|
final weightNode = FocusNode();
|
||||||
|
int current = 0;
|
||||||
|
int minutes = 3;
|
||||||
|
int seconds = 30;
|
||||||
|
Timer? timer;
|
||||||
|
|
||||||
|
void startTimer() {
|
||||||
|
setState(() {
|
||||||
|
current = minutes * 60 * 1000 + seconds * 1000;
|
||||||
|
});
|
||||||
|
timer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
print("StartPlan: current=$current");
|
||||||
|
if (current == 0)
|
||||||
|
setState(() {
|
||||||
|
timer.cancel();
|
||||||
|
});
|
||||||
|
else
|
||||||
|
setState(() {
|
||||||
|
current -= 1000;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getTotals() async {
|
||||||
|
final query = await (db.selectOnly(db.gymSets)
|
||||||
|
..addColumns([db.gymSets.name, db.gymSets.sets])
|
||||||
|
..where(db.gymSets.name.isIn(exercises))
|
||||||
|
..groupBy([db.gymSets.name, db.gymSets.sets]))
|
||||||
|
.map(
|
||||||
|
(row) =>
|
||||||
|
MapEntry(row.read(db.gymSets.name), row.read(db.gymSets.sets)),
|
||||||
|
)
|
||||||
|
.get();
|
||||||
|
final map = Map.fromIterables(
|
||||||
|
query.map((entry) => entry.key),
|
||||||
|
query.map((entry) => entry.value),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
totals = [];
|
||||||
|
for (var exercise in exercises) {
|
||||||
|
totals.add(map[exercise] ?? 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
print("totals=$totals");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getCounts() async {
|
||||||
|
var countExp = db.gymSets.name.count();
|
||||||
|
final today = DateTime.now().toIso8601String().split('T')[0];
|
||||||
|
final query = await (db.selectOnly(db.gymSets)
|
||||||
|
..addColumns([countExp, db.gymSets.name])
|
||||||
|
..where(db.gymSets.created.contains(today))
|
||||||
|
..groupBy([db.gymSets.name]))
|
||||||
|
.map((row) => MapEntry(row.read(db.gymSets.name), row.read(countExp)))
|
||||||
|
.get();
|
||||||
|
final map = Map.fromIterables(
|
||||||
|
query.map((entry) => entry.key),
|
||||||
|
query.map((entry) => entry.value),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
counts = [];
|
||||||
|
for (var exercise in exercises) {
|
||||||
|
counts.add(map[exercise] ?? 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
print("counts=$counts");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> focus(int index) async {
|
||||||
|
final name = exercises[index];
|
||||||
|
final sets = await (db.gymSets.select()
|
||||||
|
..where((gymSet) => gymSet.name.contains(name))
|
||||||
|
..orderBy([
|
||||||
|
(u) => OrderingTerm(expression: u.created, mode: OrderingMode.desc),
|
||||||
|
])
|
||||||
|
..limit(1))
|
||||||
|
.get();
|
||||||
|
final firstSet = sets.first;
|
||||||
|
setState(() {
|
||||||
|
repsController.text = firstSet.reps.toString();
|
||||||
|
repsController.selection = TextSelection(
|
||||||
|
baseOffset: 0,
|
||||||
|
extentOffset: firstSet.reps.toString().length,
|
||||||
|
);
|
||||||
|
weightController.text = firstSet.weight.toString();
|
||||||
|
minutes = firstSet.minutes;
|
||||||
|
seconds = firstSet.seconds;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
exercises = widget.plan.exercises.value.split(',');
|
||||||
|
repsNode.requestFocus();
|
||||||
|
getCounts();
|
||||||
|
getTotals();
|
||||||
|
focus(selectedExercise);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
timer?.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (totals.isEmpty || counts.isEmpty) return Container();
|
||||||
|
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(title: const Text('Start plan')),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: material.Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemBuilder: ((context, index) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(exercises[index]),
|
||||||
|
subtitle: Text("${counts[index]}/${totals[index]}"),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selectedExercise = index;
|
||||||
|
focus(index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
leading: Radio<int>(
|
||||||
|
value: index,
|
||||||
|
groupValue: selectedExercise,
|
||||||
|
onChanged: (value) {
|
||||||
|
print("onChanged $value");
|
||||||
|
if (value == null) return;
|
||||||
|
setState(() {
|
||||||
|
selectedExercise = value;
|
||||||
|
focus(index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
itemCount: exercises.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
decoration: const InputDecoration(labelText: 'Reps'),
|
||||||
|
controller: repsController,
|
||||||
|
focusNode: repsNode,
|
||||||
|
onTap: () {
|
||||||
|
repsController.selection = TextSelection(
|
||||||
|
baseOffset: 0,
|
||||||
|
extentOffset: repsController.text.length,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
decoration: const InputDecoration(labelText: 'Weight'),
|
||||||
|
controller: weightController,
|
||||||
|
focusNode: weightNode,
|
||||||
|
onTap: () {
|
||||||
|
weightController.selection = TextSelection(
|
||||||
|
baseOffset: 0,
|
||||||
|
extentOffset: weightController.text.length,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
LinearProgressIndicator(
|
||||||
|
value: current / (minutes * 60 * 1000 + seconds * 1000),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () async {
|
||||||
|
final gymSet = GymSetsCompanion(
|
||||||
|
created: Value(DateTime.now().toIso8601String()),
|
||||||
|
name: Value(exercises[selectedExercise]),
|
||||||
|
reps: Value(int.tryParse(repsController.text) ?? 0),
|
||||||
|
weight: Value(double.tryParse(weightController.text) ?? 0),
|
||||||
|
);
|
||||||
|
await db.into(db.gymSets).insert(gymSet);
|
||||||
|
const platform = MethodChannel('com.massive/android');
|
||||||
|
platform
|
||||||
|
.invokeMethod('timer', [minutes * 60 * 1000 + seconds * 1000]);
|
||||||
|
startTimer();
|
||||||
|
await getCounts();
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.check),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,9 +6,13 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <audioplayers_linux/audioplayers_linux_plugin.h>
|
||||||
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin");
|
||||||
|
audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
|
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
|
||||||
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
|
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
audioplayers_linux
|
||||||
sqlite3_flutter_libs
|
sqlite3_flutter_libs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,13 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import audioplayers_darwin
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
import sqflite
|
import sqflite
|
||||||
import sqlite3_flutter_libs
|
import sqlite3_flutter_libs
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||||
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
|
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
|
||||||
|
|||||||
+283
-110
@@ -29,18 +29,74 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: args
|
name: args
|
||||||
sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440"
|
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.0"
|
version: "2.4.2"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
|
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.10.0"
|
version: "2.11.0"
|
||||||
|
audioplayers:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: audioplayers
|
||||||
|
sha256: d9f6ca8e9b3e5af5e73d4c814404566f72698ee7ba35487bdf2baa6749e7503f
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.2.0"
|
||||||
|
audioplayers_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_android
|
||||||
|
sha256: fb01b9481f431fe04ac60f1f97ce8158383f2dc754558820592f795d81ca9d53
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.2"
|
||||||
|
audioplayers_darwin:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_darwin
|
||||||
|
sha256: "3034e99a6df8d101da0f5082dcca0a2a99db62ab1d4ddb3277bed3f6f81afe08"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.2"
|
||||||
|
audioplayers_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_linux
|
||||||
|
sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
|
audioplayers_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_platform_interface
|
||||||
|
sha256: "365c547f1bb9e77d94dd1687903a668d8f7ac3409e48e6e6a3668a1ac2982adb"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.0"
|
||||||
|
audioplayers_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_web
|
||||||
|
sha256: "22cd0173e54d92bd9b2c80b1204eb1eb159ece87475ab58c9788a70ec43c2a62"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.1.0"
|
||||||
|
audioplayers_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_windows
|
||||||
|
sha256: "9536812c9103563644ada2ef45ae523806b0745f7a78e89d1b5fb1951de90e1a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -53,10 +109,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build
|
name: build
|
||||||
sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777"
|
sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.1"
|
version: "2.4.1"
|
||||||
build_config:
|
build_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -69,10 +125,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_daemon
|
name: build_daemon
|
||||||
sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169"
|
sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "4.0.1"
|
||||||
build_resolvers:
|
build_resolvers:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -85,18 +141,18 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: build_runner
|
name: build_runner
|
||||||
sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727
|
sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.3"
|
version: "2.4.6"
|
||||||
build_runner_core:
|
build_runner_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_runner_core
|
name: build_runner_core
|
||||||
sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292"
|
sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.2.7"
|
version: "7.2.10"
|
||||||
built_collection:
|
built_collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -109,18 +165,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: built_value
|
name: built_value
|
||||||
sha256: "31b7c748fd4b9adf8d25d72a4c4a59ef119f12876cf414f94f8af5131d5fa2b0"
|
sha256: "723b4021e903217dfc445ec4cf5b42e27975aece1fc4ebbc1ca6329c2d9fb54e"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.4.4"
|
version: "8.7.0"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
|
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.1"
|
version: "1.3.0"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -133,10 +189,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: checked_yaml
|
name: checked_yaml
|
||||||
sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311"
|
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.3"
|
||||||
cli_util:
|
cli_util:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -157,18 +213,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: code_builder
|
name: code_builder
|
||||||
sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe"
|
sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.4.0"
|
version: "4.7.0"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
|
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.0"
|
version: "1.17.2"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -181,18 +237,26 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: crypto
|
name: crypto
|
||||||
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
|
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.0.3"
|
||||||
|
csv:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: csv
|
||||||
|
sha256: "63ed2871dd6471193dffc52c0e6c76fb86269c00244d244297abbb355c84a86e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.1.1"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: cupertino_icons
|
name: cupertino_icons
|
||||||
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
|
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.5"
|
version: "1.0.6"
|
||||||
dart_style:
|
dart_style:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -229,10 +293,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: ffi
|
name: ffi
|
||||||
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978
|
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.1.0"
|
||||||
file:
|
file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -241,6 +305,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.4"
|
version: "6.1.4"
|
||||||
|
file_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: file_picker
|
||||||
|
sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.1"
|
||||||
fixnum:
|
fixnum:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -258,15 +330,36 @@ packages:
|
|||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: flutter_lints
|
name: flutter_lints
|
||||||
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
|
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "3.0.1"
|
||||||
|
flutter_plugin_android_lifecycle:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_plugin_android_lifecycle
|
||||||
|
sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.17"
|
||||||
|
flutter_staggered_grid_view:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_staggered_grid_view
|
||||||
|
sha256: "19e7abb550c96fbfeb546b23f3ff356ee7c59a019a651f8f102a4ba9b7349395"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.7.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
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:
|
||||||
@@ -279,18 +372,26 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: glob
|
name: glob
|
||||||
sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c"
|
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
graphs:
|
graphs:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: graphs
|
name: graphs
|
||||||
sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2
|
sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.3.1"
|
||||||
|
http:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: http
|
||||||
|
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.13.6"
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -307,6 +408,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.2"
|
version: "4.0.2"
|
||||||
|
infinite_scroll_pagination:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: infinite_scroll_pagination
|
||||||
|
sha256: b68bce20752fcf36c7739e60de4175494f74e99e9a69b4dd2fe3a1dd07a7f16a
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.0"
|
||||||
|
intl:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: intl
|
||||||
|
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.18.1"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -319,58 +436,58 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: js
|
||||||
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
|
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.5"
|
version: "0.6.7"
|
||||||
json_annotation:
|
json_annotation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: json_annotation
|
name: json_annotation
|
||||||
sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317
|
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.8.0"
|
version: "4.8.1"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: lints
|
name: lints
|
||||||
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
|
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "3.0.0"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: logging
|
name: logging
|
||||||
sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d"
|
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "1.2.0"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
|
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.13"
|
version: "0.12.16"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
|
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.5.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
|
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.9.1"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -415,74 +532,114 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
|
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.2"
|
version: "1.8.3"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
sha256: c7edf82217d4b2952b2129a61d3ad60f1075b9299e629e149a8d2e39c2e6aad4
|
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.14"
|
version: "2.1.1"
|
||||||
path_provider_android:
|
path_provider_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
sha256: "019f18c9c10ae370b08dce1f3e3b73bc9f58e7f087bb5e921f06529438ac0ae7"
|
sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.24"
|
version: "2.2.1"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_foundation
|
name: path_provider_foundation
|
||||||
sha256: "818b2dc38b0f178e0ea3f7cf3b28146faab11375985d815942a68eee11c2d0f7"
|
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.3.1"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_linux
|
name: path_provider_linux
|
||||||
sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1"
|
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.10"
|
version: "2.2.1"
|
||||||
path_provider_platform_interface:
|
path_provider_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_platform_interface
|
name: path_provider_platform_interface
|
||||||
sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec"
|
sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.6"
|
version: "2.1.1"
|
||||||
path_provider_windows:
|
path_provider_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_windows
|
name: path_provider_windows
|
||||||
sha256: f53720498d5a543f9607db4b0e997c4b5438884de25b0f73098cc2671a51b130
|
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.5"
|
version: "2.2.1"
|
||||||
|
permission_handler:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: permission_handler
|
||||||
|
sha256: "284a66179cabdf942f838543e10413246f06424d960c92ba95c84439154fcac8"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "11.0.1"
|
||||||
|
permission_handler_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_android
|
||||||
|
sha256: f9fddd3b46109bd69ff3f9efa5006d2d309b7aec0f3c1c5637a60a2d5659e76e
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "11.1.0"
|
||||||
|
permission_handler_apple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_apple
|
||||||
|
sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "9.1.4"
|
||||||
|
permission_handler_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_platform_interface
|
||||||
|
sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.12.0"
|
||||||
|
permission_handler_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_windows
|
||||||
|
sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: platform
|
name: platform
|
||||||
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
|
sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.3"
|
||||||
plugin_platform_interface:
|
plugin_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc"
|
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.6"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -491,30 +648,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.1"
|
version: "1.5.1"
|
||||||
process:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: process
|
|
||||||
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "4.2.4"
|
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pub_semver
|
name: pub_semver
|
||||||
sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17"
|
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.3"
|
version: "2.1.4"
|
||||||
pubspec_parse:
|
pubspec_parse:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pubspec_parse
|
name: pubspec_parse
|
||||||
sha256: ec85d7d55339d85f44ec2b682a82fea340071e8978257e5a43e69f79e98ef50c
|
sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.2"
|
version: "1.2.3"
|
||||||
recase:
|
recase:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -527,23 +676,31 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf
|
name: shelf
|
||||||
sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c
|
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.4.1"
|
||||||
shelf_web_socket:
|
shelf_web_socket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_web_socket
|
name: shelf_web_socket
|
||||||
sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8
|
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "1.0.4"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.99"
|
version: "0.0.99"
|
||||||
|
sliver_tools:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: sliver_tools
|
||||||
|
sha256: eae28220badfb9d0559207badcbbc9ad5331aac829a88cb0964d330d2a4636a6
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.12"
|
||||||
source_gen:
|
source_gen:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -556,42 +713,42 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
|
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.10.0"
|
||||||
sqflite:
|
sqflite:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: sqflite
|
name: sqflite
|
||||||
sha256: "500d6fec583d2c021f2d25a056d96654f910662c64f836cd2063167b8f1fa758"
|
sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.6"
|
version: "2.3.0"
|
||||||
sqflite_common:
|
sqflite_common:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: sqflite_common
|
name: sqflite_common
|
||||||
sha256: "963dad8c4aa2f814ce7d2d5b1da2f36f31bd1a439d8f27e3dc189bb9d26bc684"
|
sha256: "8ed044102f3135add97be8653662052838859f5400075ef227f8ad72ae320803"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.3"
|
version: "2.5.0+1"
|
||||||
sqlite3:
|
sqlite3:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: sqlite3
|
name: sqlite3
|
||||||
sha256: "822d321a008e194d7929357e5b58d2e4a04ab670d137182f9759152aa33180ff"
|
sha256: "281b672749af2edf259fc801f0fcba092257425bcd32a0ce1c8237130bc934c7"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.1"
|
version: "1.11.2"
|
||||||
sqlite3_flutter_libs:
|
sqlite3_flutter_libs:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: sqlite3_flutter_libs
|
name: sqlite3_flutter_libs
|
||||||
sha256: "02f80aea54a19a36b347dedf6d4181ecd9107f5831ea6139cfd0376a3de197ba"
|
sha256: "3e3583b77cf888a68eae2e49ee4f025f66b86623ef0d83c297c8d903daa14871"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.13"
|
version: "0.5.18"
|
||||||
sqlparser:
|
sqlparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -636,10 +793,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: synchronized
|
name: synchronized
|
||||||
sha256: "33b31b6beb98100bf9add464a36a8dd03eb10c7a8cf15aeec535e9b054aaf04b"
|
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.1"
|
version: "3.1.0"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -652,10 +809,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
|
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.16"
|
version: "0.6.0"
|
||||||
timing:
|
timing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -668,10 +825,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: typed_data
|
name: typed_data
|
||||||
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
|
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.1"
|
version: "1.3.2"
|
||||||
|
uuid:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: uuid
|
||||||
|
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.7"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -684,42 +849,50 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: watcher
|
name: watcher
|
||||||
sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0"
|
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.1.0"
|
||||||
|
web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: web
|
||||||
|
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.4-beta"
|
||||||
web_socket_channel:
|
web_socket_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: web_socket_channel
|
name: web_socket_channel
|
||||||
sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b
|
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0"
|
version: "2.4.0"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: win32
|
name: win32
|
||||||
sha256: a6f0236dbda0f63aa9a25ad1ff9a9d8a4eaaa5012da0dc59d21afdb1dc361ca4
|
sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.4"
|
version: "5.0.9"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: xdg_directories
|
name: xdg_directories
|
||||||
sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1
|
sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.0.3"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: yaml
|
name: yaml
|
||||||
sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370"
|
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.19.5 <3.0.0"
|
dart: ">=3.1.0-185.0.dev <4.0.0"
|
||||||
flutter: ">=3.3.0"
|
flutter: ">=3.10.0"
|
||||||
|
|||||||
+7
-1
@@ -42,6 +42,12 @@ dependencies:
|
|||||||
path_provider: ^2.0.14
|
path_provider: ^2.0.14
|
||||||
sqlite3_flutter_libs: ^0.5.13
|
sqlite3_flutter_libs: ^0.5.13
|
||||||
moor: ^4.6.1+1
|
moor: ^4.6.1+1
|
||||||
|
file_picker: ^6.1.1
|
||||||
|
audioplayers: ^5.2.0
|
||||||
|
intl: ^0.18.0
|
||||||
|
permission_handler: ^11.0.1
|
||||||
|
infinite_scroll_pagination: ^4.0.0
|
||||||
|
csv: ^5.1.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@@ -52,7 +58,7 @@ dev_dependencies:
|
|||||||
# activated in the `analysis_options.yaml` file located at the root of your
|
# activated in the `analysis_options.yaml` file located at the root of your
|
||||||
# package. See that file for information about deactivating specific lint
|
# package. See that file for information about deactivating specific lint
|
||||||
# rules and activating additional ones.
|
# rules and activating additional ones.
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^3.0.1
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|||||||
@@ -6,9 +6,15 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <audioplayers_windows/audioplayers_windows_plugin.h>
|
||||||
|
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||||
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
AudioplayersWindowsPluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
|
||||||
|
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||||
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
|
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
|
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
audioplayers_windows
|
||||||
|
permission_handler_windows
|
||||||
sqlite3_flutter_libs
|
sqlite3_flutter_libs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() {
|
|||||||
this->Show();
|
this->Show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Flutter can complete the first frame before the "show window" callback is
|
||||||
|
// registered. The following call ensures a frame is pending to ensure the
|
||||||
|
// window is shown. It is a no-op if the first frame hasn't completed yet.
|
||||||
|
flutter_controller_->ForceRedraw();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user