From d6e62024d7cf0661f12d4db325107eb4a496f6b7 Mon Sep 17 00:00:00 2001 From: Joshua Burman Date: Sun, 8 Dec 2024 14:14:10 -0500 Subject: [PATCH 1/6] added dash for local db, ui prep work --- lib/models/activity_timer_model.dart | 20 ++- lib/widgets/activity_card.dart | 45 +++++-- lib/widgets/activity_view.dart | 195 +++++++++++++++------------ lib/widgets/session_card.dart | 6 +- lib/widgets/session_view.dart | 104 ++++++++------ pubspec.yaml | 2 + 6 files changed, 235 insertions(+), 137 deletions(-) diff --git a/lib/models/activity_timer_model.dart b/lib/models/activity_timer_model.dart index 46fbdee..8159ed8 100644 --- a/lib/models/activity_timer_model.dart +++ b/lib/models/activity_timer_model.dart @@ -13,6 +13,7 @@ class ActivityTimerModel with ChangeNotifier { Timer? _periodicTimer; double _progress = 0; ItemScrollController? _isc; + int _totalTime = 0; int get actionCount => _actionCounter; int get currentActionNum => _currentActionNum; @@ -24,6 +25,7 @@ class ActivityTimerModel with ChangeNotifier { Timer? get periodicTimer => _periodicTimer; bool get isActive => _isActive(); double get progress => _progress; + int get totalTime => _totalTime; void setup(ActivityModel activity) { if (_activity == null || activity.id != _activity?.id) { @@ -35,11 +37,26 @@ class ActivityTimerModel with ChangeNotifier { _currentActionNum = 0; _currentSetNum = 0; setActionCount(); + getTotalTime(); } moveToIndex(_currentSetNum); } + void getTotalTime() { + int time = 0; + for(int setIndex = 0; _sets.length > setIndex; setIndex++) { + for (int actionIndex = 0; _sets[setIndex].length > actionIndex; actionIndex++) { + var action = _sets[setIndex][actionIndex]; + if (action['type'] == 'seconds') { + time = time + action['amount'] as int; + } + } + } + + _totalTime = time; + } + void reset() { _progress = 0; _currentActionNum = 0; @@ -89,6 +106,7 @@ class ActivityTimerModel with ChangeNotifier { case 'seconds': if (_actionCounter > 0) { _actionCounter--; + _totalTime--; } else { nextAction(_currentActionNum + 1); setActionCount(); @@ -110,8 +128,8 @@ class ActivityTimerModel with ChangeNotifier { void setAction(int setNum, int actionNum, String type) { _currentActionNum = actionNum; _currentSetNum = setNum; - moveToIndex(_currentSetNum); notifyListeners(); + moveToIndex(_currentSetNum); } void nextAction(int nextActionIndex) { diff --git a/lib/widgets/activity_card.dart b/lib/widgets/activity_card.dart index af38eba..776be35 100644 --- a/lib/widgets/activity_card.dart +++ b/lib/widgets/activity_card.dart @@ -1,20 +1,39 @@ import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:sendtrain/classes/media.dart'; import 'package:sendtrain/models/activity_model.dart'; +import 'package:sendtrain/models/activity_timer_model.dart'; import 'package:sendtrain/widgets/activity_view.dart'; -class ActivityCard extends StatelessWidget { +class ActivityCard extends StatefulWidget { + final ActivityModel activity; + const ActivityCard({super.key, required this.activity}); - final ActivityModel activity; + @override + State createState() => ActivityCardState(); +} + +class ActivityCardState extends State { + String formattedTime(int timeInSecond) { + int sec = timeInSecond % 60; + int min = (timeInSecond / 60).floor(); + String minute = min.toString().length <= 1 ? "0$min" : "$min"; + String second = sec.toString().length <= 1 ? "0$sec" : "$sec"; + return "$minute:$second"; + } @override Widget build(BuildContext context) { + final ActivityTimerModel atm = + Provider.of(context, listen: false); + return Card( - color: const Color(0xff3A5FB6), + color: atm.activity?.id == widget.activity.id + ? Theme.of(context).colorScheme.primaryContainer + : Theme.of(context).colorScheme.surfaceContainerLow, clipBehavior: Clip.hardEdge, child: InkWell( - splashColor: Colors.deepPurple, onTap: () => showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionDuration: const Duration(milliseconds: 220), @@ -29,7 +48,7 @@ class ActivityCard extends StatelessWidget { return SlideTransition( position: custom, child: Dialog.fullscreen( - child: ActivityView(activity: activity))); + child: ActivityView(activity: widget.activity))); }, barrierDismissible: true, barrierLabel: '', @@ -49,14 +68,24 @@ class ActivityCard extends StatelessWidget { image: DecorationImage( fit: BoxFit.cover, image: findMediaByType( - activity.actions[0].media, 'image')), + widget.activity.actions[0].media, 'image')), // color: Colors.blue, borderRadius: const BorderRadius.all(Radius.elliptical(10, 10)), ), )), - title: Text(maxLines: 1, activity.title), - subtitle: Text(maxLines: 2, activity.description), + title: Consumer( + builder: (context, atm, child) { + if (atm.activity?.id == widget.activity.id) { + return Text( + maxLines: 1, + "${widget.activity.title} (${formattedTime(atm.totalTime)})"); + } else { + return Text(maxLines: 1, widget.activity.title); + } + }, + ), + subtitle: Text(maxLines: 2, widget.activity.description), ), ], )), diff --git a/lib/widgets/activity_view.dart b/lib/widgets/activity_view.dart index 72820b1..7aa1dc5 100644 --- a/lib/widgets/activity_view.dart +++ b/lib/widgets/activity_view.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_expandable_fab/flutter_expandable_fab.dart'; import 'package:provider/provider.dart'; import 'package:sendtrain/classes/activity_action.dart'; import 'package:sendtrain/classes/media.dart'; @@ -24,94 +25,122 @@ class _ActivityViewState extends State { atm.setup(activity); - return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppBar( - centerTitle: true, - title: const Text('Activity', style: TextStyle(fontSize: 15)), - ), - Padding( - padding: - const EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 10), - child: Text( - maxLines: 1, - style: const TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - activity.title)), - ActivityViewCategories(categories: activity.categories), - Padding( - padding: - const EdgeInsets.only(top: 0, bottom: 20, left: 15, right: 15), - child: Text( - textAlign: TextAlign.left, - style: const TextStyle(fontSize: 15), - activity.description)), - ActivityViewMedia(activity: activity), - const Padding( - padding: EdgeInsets.fromLTRB(15, 30, 0, 10), - child: Text( - textAlign: TextAlign.left, - style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - 'Actions')), - Padding( - padding: const EdgeInsets.only(left: 10, right: 10), - child: Card( - clipBehavior: Clip.antiAlias, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10)), + return Scaffold( + floatingActionButtonLocation: ExpandableFab.location, + floatingActionButton: ExpandableFab( + distance: 70, + type: ExpandableFabType.up, + overlayStyle: ExpandableFabOverlayStyle( + color: Colors.black.withOpacity(0.5), + blur: 10, + ), + children: [ + FloatingActionButton.extended( + icon: const Icon(Icons.history_outlined), + label: Text('Restart'), + onPressed: () {}, ), - color: Theme.of(context).colorScheme.onPrimary, - child: Row(children: [ - Ink( - width: 70, - color: Theme.of(context).colorScheme.primaryContainer, - child: Consumer( - builder: (context, atm, child) { - return IconButton( - alignment: AlignmentDirectional.center, - icon: atm.isActive - ? const Icon(Icons.pause_rounded) - : const Icon(Icons.play_arrow_rounded), - onPressed: () => - {atm.isActive ? atm.pause() : atm.start()}); - }, - )), - Expanded( - flex: 1, - child: Stack(alignment: Alignment.center, children: [ - Container( - alignment: Alignment.center, + FloatingActionButton.extended( + icon: const Icon(Icons.done_all_outlined), + label: Text('Done'), + onPressed: () {}, + ), + FloatingActionButton.extended( + icon: const Icon(Icons.edit_outlined), + label: Text('Edit'), + onPressed: () {}, + ), + ]), + body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppBar( + centerTitle: true, + title: const Text('Activity', style: TextStyle(fontSize: 15)), + ), + Padding( + padding: const EdgeInsets.only( + left: 15, right: 20, top: 15, bottom: 10), + child: Text( + maxLines: 1, + style: const TextStyle( + fontSize: 25, fontWeight: FontWeight.bold), + activity.title)), + ActivityViewCategories(categories: activity.categories), + Padding( + padding: const EdgeInsets.only( + top: 0, bottom: 20, left: 15, right: 15), + child: Text( + textAlign: TextAlign.left, + style: const TextStyle(fontSize: 15), + activity.description)), + ActivityViewMedia(activity: activity), + const Padding( + padding: EdgeInsets.fromLTRB(15, 30, 0, 10), + child: Text( + textAlign: TextAlign.left, + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + 'Actions')), + Padding( + padding: const EdgeInsets.only(left: 10, right: 10), + child: Card( + clipBehavior: Clip.antiAlias, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), + topRight: Radius.circular(10)), + ), + color: Theme.of(context).colorScheme.onPrimary, + child: Row(children: [ + Ink( + width: 70, + color: Theme.of(context).colorScheme.primaryContainer, child: Consumer( builder: (context, atm, child) { - return Text( - style: const TextStyle(fontSize: 20), - textAlign: TextAlign.center, - '${atm.actionCount} ${atm.currentAction['type']}'); + return IconButton( + alignment: AlignmentDirectional.center, + icon: atm.isActive + ? const Icon(Icons.pause_rounded) + : const Icon(Icons.play_arrow_rounded), + onPressed: () => + {atm.isActive ? atm.pause() : atm.start()}); }, - ), - ), - Container( - alignment: Alignment.centerRight, - padding: EdgeInsets.only(right: 10), - child: Consumer( + )), + Expanded( + flex: 1, + child: Stack(alignment: Alignment.center, children: [ + Container( + alignment: Alignment.center, + child: Consumer( builder: (context, atm, child) { - return Text( - style: const TextStyle(fontSize: 12), - textAlign: TextAlign.right, - '${atm.currentAction['actionID'] + 1} of ${atm.totalActions()}'); - })), - ])), - ]))), - Padding( - padding: EdgeInsets.only(left: 14, right: 14), - child: Consumer(builder: (context, atm, child) { - return LinearProgressIndicator( - value: atm.progress, - semanticsLabel: 'Activity Progress', - ); - })), - ActivityActionView(action: activity.actions[0]), - ]); + return Text( + style: const TextStyle(fontSize: 20), + textAlign: TextAlign.center, + '${atm.actionCount} ${atm.currentAction['type']}'); + }, + ), + ), + Container( + alignment: Alignment.centerRight, + padding: EdgeInsets.only(right: 10), + child: Consumer( + builder: (context, atm, child) { + return Text( + style: const TextStyle(fontSize: 12), + textAlign: TextAlign.right, + '${atm.currentAction['actionID'] + 1} of ${atm.totalActions()}'); + })), + ])), + ]))), + Padding( + padding: EdgeInsets.only(left: 14, right: 14), + child: + Consumer(builder: (context, atm, child) { + return LinearProgressIndicator( + value: atm.progress, + semanticsLabel: 'Activity Progress', + ); + })), + ActivityActionView(action: activity.actions[0]), + ])); } } diff --git a/lib/widgets/session_card.dart b/lib/widgets/session_card.dart index fd030dd..cd4eb0c 100644 --- a/lib/widgets/session_card.dart +++ b/lib/widgets/session_card.dart @@ -18,8 +18,8 @@ class SessionCard extends StatelessWidget { final DateFormat dateFormat = DateFormat('yyyy-MM-dd'); Color color = (state == 0) - ? const Color(0xff3A5FB6) - : ThemeData.dark(useMaterial3: true).colorScheme.surfaceBright; + ? Theme.of(context).colorScheme.primaryContainer + : Theme.of(context).colorScheme.surfaceContainerLow; // place holder until we can retrieve real data final data = SessionModel( @@ -228,7 +228,7 @@ class SessionCard extends StatelessWidget { ); } else { return Card( - color: const Color.fromARGB(125, 0, 0, 0), + color: color, child: InkWell( // overlayColor: MaterialStateColor(Colors.deepPurple as int), splashColor: Colors.deepPurple, diff --git a/lib/widgets/session_view.dart b/lib/widgets/session_view.dart index fa6002a..6965a18 100644 --- a/lib/widgets/session_view.dart +++ b/lib/widgets/session_view.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_expandable_fab/flutter_expandable_fab.dart'; import 'package:intl/intl.dart'; import 'package:intl/date_symbol_data_local.dart'; @@ -18,48 +19,67 @@ class SessionView extends StatelessWidget { initializeDateFormatting('en'); final DateFormat dateFormat = DateFormat('yyyy-MM-dd'); - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppBar( - centerTitle: true, - title: Text('Session @ ${dateFormat.format(data.date)}', - style: const TextStyle(fontSize: 15)), - ), - Padding( - padding: - const EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 10), - child: Text( - maxLines: 1, - style: - const TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - data.title)), - SessionViewAchievements(achievements: data.achievements), - Padding( - padding: const EdgeInsets.only(left: 15, right: 15), - child: Text( - style: const TextStyle(fontSize: 15), - data.content)), - const Padding( - padding: EdgeInsets.fromLTRB(15, 30, 0, 10), - child: Text( - style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - 'Media:')), - SessionViewMedia(media: data.media), - const Padding( - padding: EdgeInsets.fromLTRB(15, 30, 0, 10), - child: Text( - style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - 'Activites:')), - SessionViewActivities(activities: data.activities), - // TextButton( - // onPressed: () { - // Navigator.pop(context); - // }, - // child: const Text('Close'), - // ), - ], - ); + return Scaffold( + floatingActionButtonLocation: ExpandableFab.location, + floatingActionButton: ExpandableFab( + distance: 70, + type: ExpandableFabType.up, + overlayStyle: ExpandableFabOverlayStyle( + color: Colors.black.withOpacity(0.5), + blur: 10, + ), + children: [ + FloatingActionButton.extended( + icon: const Icon(Icons.history_outlined), + label: Text('Restart'), + onPressed: () {}, + ), + FloatingActionButton.extended( + icon: const Icon(Icons.done_all_outlined), + label: Text('Done'), + onPressed: () {}, + ), + FloatingActionButton.extended( + icon: const Icon(Icons.edit_outlined), + label: Text('Edit'), + onPressed: () {}, + ), + ]), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppBar( + centerTitle: true, + title: Text('Session @ ${dateFormat.format(data.date)}', + style: const TextStyle(fontSize: 15)), + ), + Padding( + padding: const EdgeInsets.only( + left: 15, right: 20, top: 15, bottom: 10), + child: Text( + maxLines: 1, + style: const TextStyle( + fontSize: 25, fontWeight: FontWeight.bold), + data.title)), + SessionViewAchievements(achievements: data.achievements), + Padding( + padding: const EdgeInsets.only(left: 15, right: 15), + child: + Text(style: const TextStyle(fontSize: 15), data.content)), + const Padding( + padding: EdgeInsets.fromLTRB(15, 30, 0, 10), + child: Text( + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + 'Media:')), + SessionViewMedia(media: data.media), + const Padding( + padding: EdgeInsets.fromLTRB(15, 30, 0, 10), + child: Text( + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + 'Activites:')), + SessionViewActivities(activities: data.activities), + ], + )); } } diff --git a/pubspec.yaml b/pubspec.yaml index f1206c7..292cf1e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,6 +41,8 @@ dependencies: json_annotation: ^4.9.0 provider: ^6.1.2 scrollable_positioned_list: ^0.3.8 + drift: ^2.22.1 + flutter_expandable_fab: ^2.3.0 flutter_launcher_name: name: "SendTrain" -- 2.47.2 From 13fe7e2ef43a30e10d75e96a006f30a19881315b Mon Sep 17 00:00:00 2001 From: Joshua Burman Date: Sun, 8 Dec 2024 14:40:12 -0500 Subject: [PATCH 2/6] more prep work for local data storage --- lib/widgets/activity_card.dart | 76 ++++++++++++++++++++++------------ lib/widgets/session_card.dart | 23 ++++++++++ 2 files changed, 72 insertions(+), 27 deletions(-) diff --git a/lib/widgets/activity_card.dart b/lib/widgets/activity_card.dart index 776be35..20386bc 100644 --- a/lib/widgets/activity_card.dart +++ b/lib/widgets/activity_card.dart @@ -60,33 +60,55 @@ class ActivityCardState extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - leading: Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - child: Container( - width: 60, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: findMediaByType( - widget.activity.actions[0].media, 'image')), - // color: Colors.blue, - borderRadius: - const BorderRadius.all(Radius.elliptical(10, 10)), - ), - )), - title: Consumer( - builder: (context, atm, child) { - if (atm.activity?.id == widget.activity.id) { - return Text( - maxLines: 1, - "${widget.activity.title} (${formattedTime(atm.totalTime)})"); - } else { - return Text(maxLines: 1, widget.activity.title); - } - }, - ), - subtitle: Text(maxLines: 2, widget.activity.description), - ), + leading: Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), + child: Container( + width: 60, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.cover, + image: findMediaByType( + widget.activity.actions[0].media, 'image')), + // color: Colors.blue, + borderRadius: + const BorderRadius.all(Radius.elliptical(10, 10)), + ), + )), + title: Consumer( + builder: (context, atm, child) { + if (atm.activity?.id == widget.activity.id) { + return Text( + maxLines: 1, + "${widget.activity.title} (${formattedTime(atm.totalTime)})"); + } else { + return Text(maxLines: 1, widget.activity.title); + } + }, + ), + subtitle: Text(maxLines: 2, widget.activity.description), + trailing: IconButton( + visualDensity: VisualDensity.compact, + icon: Icon(Icons.close_rounded), + onPressed: () { + showAdaptiveDialog( + context: context, + builder: (BuildContext context) => AlertDialog( + title: const Text('Activity Removal'), + content: const Text('Would you like to permanently remove this activity from the current session?'), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, 'Cancel'), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () => Navigator.pop(context, 'OK'), + child: const Text('OK'), + ), + ], + ), + ); + }, + )), ], )), ); diff --git a/lib/widgets/session_card.dart b/lib/widgets/session_card.dart index cd4eb0c..3169cd0 100644 --- a/lib/widgets/session_card.dart +++ b/lib/widgets/session_card.dart @@ -214,6 +214,29 @@ class SessionCard extends StatelessWidget { )), title: Text(maxLines: 1, data.title), subtitle: Text(maxLines: 1, dateFormat.format(data.date)), + trailing: IconButton( + visualDensity: VisualDensity.compact, + icon: Icon(Icons.close_rounded), + onPressed: () { + showAdaptiveDialog( + context: context, + builder: (BuildContext context) => AlertDialog( + title: const Text('Session Removal'), + content: const Text('Would you like to permanently remove this session?'), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, 'Cancel'), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () => Navigator.pop(context, 'OK'), + child: const Text('OK'), + ), + ], + ), + ); + }, + ), ), ListTile( contentPadding: const EdgeInsets.fromLTRB(15, 0, 15, 15), -- 2.47.2 From 0dc7c3ced0a75c47e6db8bae10fb45a2482669aa Mon Sep 17 00:00:00 2001 From: Joshua Burman Date: Sun, 8 Dec 2024 22:25:23 -0500 Subject: [PATCH 3/6] upgraded kotlin, gradle, added drift --- .gitignore | 143 + .metadata | 34 +- .vscode/dart.code-snippets | 74 - android/.gitignore | 2 +- android/app/build.gradle | 65 +- android/app/src/debug/AndroidManifest.xml | 3 +- android/app/src/main/AndroidManifest.xml | 19 +- .../com/example/sendtrain/MainActivity.kt | 5 + .../com/example/test_app/MainActivity.kt | 6 - android/app/src/profile/AndroidManifest.xml | 3 +- android/build.gradle | 17 +- android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 30 +- ios/Podfile.lock | 33 - ios/RunnerTests/RunnerTests.swift | 12 + lib/database.dart | 95 + lib/database.g.dart | 4437 +++++++++++++++++ lib/widgets/activity_view.dart | 2 +- linux/flutter/generated_plugin_registrant.cc | 11 - linux/flutter/generated_plugin_registrant.h | 15 - linux/flutter/generated_plugins.cmake | 23 - macos/Flutter/GeneratedPluginRegistrant.swift | 12 - macos/RunnerTests/RunnerTests.swift | 12 + pubspec.yaml | 2 + .../flutter/generated_plugin_registrant.cc | 14 - windows/flutter/generated_plugin_registrant.h | 15 - windows/flutter/generated_plugins.cmake | 24 - 28 files changed, 4787 insertions(+), 325 deletions(-) delete mode 100644 .vscode/dart.code-snippets create mode 100644 android/app/src/main/kotlin/com/example/sendtrain/MainActivity.kt delete mode 100644 android/app/src/main/kotlin/com/example/test_app/MainActivity.kt delete mode 100644 ios/Podfile.lock create mode 100644 ios/RunnerTests/RunnerTests.swift create mode 100644 lib/database.dart create mode 100644 lib/database.g.dart delete mode 100644 linux/flutter/generated_plugin_registrant.cc delete mode 100644 linux/flutter/generated_plugin_registrant.h delete mode 100644 linux/flutter/generated_plugins.cmake delete mode 100644 macos/Flutter/GeneratedPluginRegistrant.swift create mode 100644 macos/RunnerTests/RunnerTests.swift delete mode 100644 windows/flutter/generated_plugin_registrant.cc delete mode 100644 windows/flutter/generated_plugin_registrant.h delete mode 100644 windows/flutter/generated_plugins.cmake diff --git a/.gitignore b/.gitignore index 84fa0f7..b5d7ad6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ .history .svn/ migrate_working_dir/ +bkp # IntelliJ related *.iml @@ -44,3 +45,145 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + + +# Do not remove or rename entries in this file, only add new ones +# See https://github.com/flutter/flutter/issues/128635 for more context. + +# Miscellaneous +*.class +*.lock +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# Visual Studio Code related +.classpath +.project +.settings/ +.vscode/* + +# Flutter repo-specific +/bin/cache/ +/bin/internal/bootstrap.bat +/bin/internal/bootstrap.sh +/bin/mingit/ +/dev/benchmarks/mega_gallery/ +/dev/bots/.recipe_deps +/dev/bots/android_tools/ +/dev/devicelab/ABresults*.json +/dev/docs/doc/ +/dev/docs/api_docs.zip +/dev/docs/flutter.docs.zip +/dev/docs/lib/ +/dev/docs/pubspec.yaml +/dev/integration_tests/**/xcuserdata +/dev/integration_tests/**/Pods +/packages/flutter/coverage/ +version +analysis_benchmark.json + +# packages file containing multi-root paths +.packages.generated + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +**/generated_plugin_registrant.dart +.packages +.pub-preload-cache/ +.pub-cache/ +.pub/ +build/ +flutter_*.png +linked_*.ds +unlinked.ds +unlinked_spec.ds + +# Android related +**/android/**/gradle-wrapper.jar +.gradle/ +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java +**/android/key.properties +*.jks + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/ephemeral +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# macOS +**/Flutter/ephemeral/ +**/Pods/ +**/macos/Flutter/GeneratedPluginRegistrant.swift +**/macos/Flutter/ephemeral +**/xcuserdata/ + +# Windows +**/windows/flutter/ephemeral/ +**/windows/flutter/generated_plugin_registrant.cc +**/windows/flutter/generated_plugin_registrant.h +**/windows/flutter/generated_plugins.cmake + +# Linux +**/linux/flutter/ephemeral/ +**/linux/flutter/generated_plugin_registrant.cc +**/linux/flutter/generated_plugin_registrant.h +**/linux/flutter/generated_plugins.cmake + +# Coverage +coverage/ + +# Symbols +app.*.symbols + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +!/dev/ci/**/Gemfile.lock +!.vscode/settings.json \ No newline at end of file diff --git a/.metadata b/.metadata index 8e89d4d..d044da8 100644 --- a/.metadata +++ b/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled. +# This file should be version controlled and should not be manually edited. version: - revision: 9944297138845a94256f1cf37beb88ff9a8e811a - channel: stable + revision: "dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668" + channel: "stable" project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 - platform: android - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 - platform: ios - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 - platform: linux - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 - platform: macos - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 - platform: web - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 - platform: windows - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 # User provided section diff --git a/.vscode/dart.code-snippets b/.vscode/dart.code-snippets deleted file mode 100644 index 994a317..0000000 --- a/.vscode/dart.code-snippets +++ /dev/null @@ -1,74 +0,0 @@ -{ - // Place your snippets for dart here. Each snippet is defined under a snippet name and has a prefix, body and - // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: - // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the - // same ids are connected. - // Example: - // "Print to console": { - // "prefix": "log", - // "body": [ - // "console.log('$1');", - // "$2" - // ], - // "description": "Log output to console" - // } - "Stateless Widget": { - "prefix": "stateless", - "body": [ - "import 'package:flutter/material.dart';", - "\n", - "class ${1:MyClass} extends StatelessWidget {", - "@override", - "Widget build(BuildContext context) {", - "return Container($0);}}" - ] - }, - "Stateful Widget": { - "prefix": "stateful", - "body": [ - "import 'package:flutter/material.dart';", - "\n", - "class ${1:MyClass} extends StatefulWidget {", - "const ${1:MyClass}({Key key, $2}) : super(key: key);", - "\n", - "@override", - "_${1:MyClass}State createState() => _${1:MyClass}State();", - "}", - "\n", - "class _${1:MyClass}State extends State<${1:MyClass}> {", - "\n", - "@override", - "void initState() {", - "super.initState();", - "}", - "\n", - "@override", - "void dispose() {", - "super.dispose();", - "}", - "\n", - "@override", - "Widget build(BuildContext context) {", - "return Container($0);}}" - ] - }, - "Widget Test": { - "prefix": "widgettest", - "body": [ - "import 'package:flutter_test/flutter_test.dart';", - "import 'package:flutter/material.dart';", - "//import 'package:piota/${1:widgetfile}.dart';", - "\n", - "import 'ui_test_util.dart';", - "\n", - "void main() {", - "group('${2:groupname}', () {", - "final testableWidget = testWidget(${3:Container()},Size(375, 667));", - "testWidgets('${3:Container()} test', (WidgetTester tester) async {", - "final finder = find.byKey(Key('${5:keyname}'));", - "await tester.pumpWidget(testableWidget);", - "expect(finder, findsOneWidget);", - "});});}" - ] - } -} \ No newline at end of file diff --git a/android/.gitignore b/android/.gitignore index 6f56801..55afd91 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -7,7 +7,7 @@ gradle-wrapper.jar GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties **/*.keystore **/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle index fead8d1..ec42960 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,71 +1,44 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion + namespace = "com.example.sendtrain" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.sendtrain.sendtrain" + applicationId = "com.example.sendtrain" // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig = signingConfigs.debug } } } flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + source = "../.." } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index f3247a5..399f698 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/sendtrain/MainActivity.kt b/android/app/src/main/kotlin/com/example/sendtrain/MainActivity.kt new file mode 100644 index 0000000..2d8f0ee --- /dev/null +++ b/android/app/src/main/kotlin/com/example/sendtrain/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.sendtrain + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/android/app/src/main/kotlin/com/example/test_app/MainActivity.kt b/android/app/src/main/kotlin/com/example/test_app/MainActivity.kt deleted file mode 100644 index ec534c5..0000000 --- a/android/app/src/main/kotlin/com/example/test_app/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.sendtrain.sendtrain - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index f3247a5..399f698 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,4 @@ - +