Browse Source

refactoring/cleaning

master
TheNils 1 month ago
parent
commit
281ec16f5e
28 changed files with 87 additions and 94 deletions
  1. +1
    -1
      README.md
  2. +1
    -1
      android/app/build.gradle
  3. +1
    -1
      android/app/src/debug/AndroidManifest.xml
  4. +2
    -2
      android/app/src/main/AndroidManifest.xml
  5. +1
    -1
      android/app/src/main/kotlin/com/example/youtribe_lib/MainActivity.kt
  6. +1
    -1
      android/app/src/profile/AndroidManifest.xml
  7. +1
    -1
      ios/Runner/Info.plist
  8. +1
    -2
      lib/api/api.dart
  9. +9
    -9
      lib/main.dart
  10. +7
    -0
      lib/store/agenciesController.dart
  11. +0
    -7
      lib/store/agencyController.dart
  12. +2
    -2
      lib/store/itemsController.dart
  13. +4
    -4
      lib/store/projectsController.dart
  14. +0
    -7
      lib/store/repportController.dart
  15. +7
    -0
      lib/store/repportsController.dart
  16. +2
    -2
      lib/store/stepsController.dart
  17. +1
    -1
      lib/store/user.dart
  18. +14
    -14
      lib/views/account.dart
  19. +8
    -8
      lib/views/accountForm.dart
  20. +5
    -4
      lib/views/agency.dart
  21. +1
    -1
      lib/views/login/login.dart
  22. +1
    -1
      lib/views/login/signInForm.dart
  23. +11
    -10
      lib/views/project.dart
  24. +0
    -7
      pubspec.lock
  25. +1
    -2
      pubspec.yaml
  26. +1
    -1
      test/widget_test.dart
  27. +2
    -2
      web/index.html
  28. +2
    -2
      web/manifest.json

+ 1
- 1
README.md View File

@ -1,4 +1,4 @@
# youtribe_lib
# directus_starter
run this project with `flutter -v run -d *chrome* --web-port=28080`


+ 1
- 1
android/app/build.gradle View File

@ -38,7 +38,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.youtribe_lib"
applicationId "com.example.directus_starter"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()


+ 1
- 1
android/app/src/debug/AndroidManifest.xml View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.youtribe_lib">
package="com.example.directus_starter">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->


+ 2
- 2
android/app/src/main/AndroidManifest.xml View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.youtribe_lib">
package="com.example.directus_starter">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
@ -10,7 +10,7 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="youtribe_lib"
android:label="directus_starter"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"


+ 1
- 1
android/app/src/main/kotlin/com/example/youtribe_lib/MainActivity.kt View File

@ -1,4 +1,4 @@
package com.example.youtribe_lib
package com.example.directus_starter
import io.flutter.embedding.android.FlutterActivity


+ 1
- 1
android/app/src/profile/AndroidManifest.xml View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.youtribe_lib">
package="com.example.directus_starter">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->


+ 1
- 1
ios/Runner/Info.plist View File

@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>youtribe_lib</string>
<string>directus_starter</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>


+ 1
- 2
lib/api/api.dart View File

@ -1,6 +1,6 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:youtribe_lib/globals.dart' as globals;
import 'package:directus_starter/globals.dart' as globals;
class Api {
// Singleton
@ -9,7 +9,6 @@ class Api {
factory Api() {
return _instance;
}
Map<String, dynamic> credentials = {};
Map<String, String> apiHeaders = {


+ 9
- 9
lib/main.dart View File

@ -1,17 +1,17 @@
import 'package:flutter/material.dart';
import 'package:youtribe_lib/globals.dart' as globals;
import 'package:directus_starter/globals.dart' as globals;
import 'package:get/get.dart';
import 'package:youtribe_lib/store/user.dart';
import 'package:directus_starter/store/user.dart';
import 'package:youtribe_lib/lang/en.dart';
import 'package:youtribe_lib/lang/fr.dart';
import 'package:directus_starter/lang/en.dart';
import 'package:directus_starter/lang/fr.dart';
import 'package:youtribe_lib/views/login/login.dart';
import 'package:youtribe_lib/views/account.dart';
import 'package:youtribe_lib/views/accountForm.dart';
import 'package:youtribe_lib/views/agency.dart';
import 'package:youtribe_lib/views/project.dart';
import 'package:directus_starter/views/login/login.dart';
import 'package:directus_starter/views/account.dart';
import 'package:directus_starter/views/accountForm.dart';
import 'package:directus_starter/views/agency.dart';
import 'package:directus_starter/views/project.dart';
// translation
class Messages extends Translations {


+ 7
- 0
lib/store/agenciesController.dart View File

@ -0,0 +1,7 @@
import 'package:directus_starter/store/itemsController.dart';
class AgenciesController extends ItemsController {
AgenciesController() : super("agency", fields: ["*.*"]) {
return;
}
}

+ 0
- 7
lib/store/agencyController.dart View File

@ -1,7 +0,0 @@
import 'package:youtribe_lib/store/itemController.dart';
class AgencyController extends ItemsController {
AgencyController() : super("agency", fields: ["*.*"]) {
print("projectController init...");
}
}

lib/store/itemController.dart → lib/store/itemsController.dart View File


lib/store/projectController.dart → lib/store/projectsController.dart View File


+ 0
- 7
lib/store/repportController.dart View File

@ -1,7 +0,0 @@
import 'package:youtribe_lib/store/itemController.dart';
class RepportController extends ItemsController {
RepportController() : super("repport", fields: ["*.*"]) {
print("projectController init...");
}
}

+ 7
- 0
lib/store/repportsController.dart View File

@ -0,0 +1,7 @@
import 'package:directus_starter/store/itemsController.dart';
class RepportsController extends ItemsController {
RepportsController() : super("repport", fields: ["*.*"]) {
return;
}
}

+ 2
- 2
lib/store/stepsController.dart View File

@ -1,7 +1,7 @@
import 'package:youtribe_lib/store/itemController.dart';
import 'package:directus_starter/store/itemsController.dart';
class StepsController extends ItemsController {
StepsController() : super("steps", fields: ["*.*"]) {
print("projectController init...");
return;
}
}

+ 1
- 1
lib/store/user.dart View File

@ -2,7 +2,7 @@ import 'dart:convert';
import 'package:get/get.dart';
import 'package:get/state_manager.dart';
import 'package:youtribe_lib/api/api.dart';
import 'package:directus_starter/api/api.dart';
import 'package:localstorage/localstorage.dart';
class UserController extends GetxController {


+ 14
- 14
lib/views/account.dart View File

@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:youtribe_lib/store/agencyController.dart';
import 'package:youtribe_lib/store/projectController.dart';
import 'package:youtribe_lib/store/user.dart';
import 'package:directus_starter/store/agenciesController.dart';
import 'package:directus_starter/store/projectsController.dart';
import 'package:directus_starter/store/user.dart';
class Account extends StatelessWidget {
final UserController userController = Get.put(UserController());
final AgencyController agencyController = Get.put(AgencyController());
final ProjectController projectController = Get.put(ProjectController());
final AgenciesController agenciesController = Get.put(AgenciesController());
final ProjectsController projectsController = Get.put(ProjectsController());
@override
Widget build(BuildContext context) {
@ -29,8 +29,8 @@ class Account extends StatelessWidget {
child: Text('edit'.tr),
),
SizedBox(height: 50),
if (agencyController.items.length > 0) ...myAgencies(),
if (projectController.items.length > 0) ...myProjects(),
if (agenciesController.items.length > 0) ...myAgencies(),
if (projectsController.items.length > 0) ...myProjects(),
],
)),
),
@ -44,11 +44,11 @@ class Account extends StatelessWidget {
SizedBox(
height: 100,
child: ListView.builder(
itemCount: agencyController.items.length,
itemCount: agenciesController.items.length,
itemBuilder: (ctx, index) {
return ListTile(
title: Text(agencyController.items[index]["title"]),
subtitle: Text(agencyController.items[index]["addresse"]),
title: Text(agenciesController.items[index]["title"]),
subtitle: Text(agenciesController.items[index]["addresse"]),
);
}),
),
@ -61,20 +61,20 @@ class Account extends StatelessWidget {
SizedBox(
height: 200,
child: ListView.builder(
itemCount: projectController.items.length,
itemCount: projectsController.items.length,
itemBuilder: (ctx, index) {
return Card(
child: Column(children: [
ListTile(
title: Text(projectController.items[index]["title"]),
subtitle: Text(projectController.items[index]["adresse"]),
title: Text(projectsController.items[index]["title"]),
subtitle: Text(projectsController.items[index]["adresse"]),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => Get.offAllNamed(
'/project?id=${projectController.items[index]["id"]}'),
'/project?id=${projectsController.items[index]["id"]}'),
child: Text('see'.tr))
],
)


+ 8
- 8
lib/views/accountForm.dart View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:youtribe_lib/store/agencyController.dart';
import 'package:youtribe_lib/store/projectController.dart';
import 'package:youtribe_lib/store/repportController.dart';
import 'package:youtribe_lib/store/stepsController.dart';
import 'package:youtribe_lib/store/user.dart';
import 'package:directus_starter/store/agenciesController.dart';
import 'package:directus_starter/store/projectsController.dart';
import 'package:directus_starter/store/repportsController.dart';
import 'package:directus_starter/store/stepsController.dart';
import 'package:directus_starter/store/user.dart';
class AccountForm extends StatefulWidget {
@override
@ -13,10 +13,10 @@ class AccountForm extends StatefulWidget {
class AccountFormState extends State<AccountForm> {
final userController = Get.put(UserController());
final projectController = Get.put(ProjectController());
final projectsController = Get.put(ProjectsController());
final stepsController = Get.put(StepsController());
final agencyController = Get.put(AgencyController());
final repportController = Get.put(RepportController());
final agenciesController = Get.put(AgenciesController());
final repportsController = Get.put(RepportsController());
final _formKey = GlobalKey<FormState>();


+ 5
- 4
lib/views/agency.dart View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:youtribe_lib/store/agencyController.dart';
import 'package:directus_starter/store/agenciesController.dart';
import 'package:get/get.dart';
import 'package:youtribe_lib/store/stepsController.dart';
import 'package:directus_starter/store/stepsController.dart';
class Agency extends StatelessWidget {
final AgencyController agencyController = Get.put(AgencyController());
final AgenciesController agenciesController = Get.put(AgenciesController());
final StepsController stepsController = Get.put(StepsController());
@override
@ -15,7 +15,8 @@ class Agency extends StatelessWidget {
),
body: Center(
child: Obx(() {
var agency = agencyController.itemsMappedOnId()[Get.parameters['id']];
var agency =
agenciesController.itemsMappedOnId()[Get.parameters['id']];
return Column(children: [Text(agency.title)]);
}),


+ 1
- 1
lib/views/login/login.dart View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:youtribe_lib/views/login/signInForm.dart';
import 'package:directus_starter/views/login/signInForm.dart';
import 'package:get/get.dart';
class Login extends StatelessWidget {


+ 1
- 1
lib/views/login/signInForm.dart View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:youtribe_lib/store/user.dart';
import 'package:directus_starter/store/user.dart';
class SignInForm extends StatefulWidget {
@override


+ 11
- 10
lib/views/project.dart View File

@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:youtribe_lib/components/editFieldModal.dart';
// import 'package:youtribe_lib/store/itemController.dart';
import 'package:youtribe_lib/store/projectController.dart';
import 'package:youtribe_lib/store/stepsController.dart';
import 'package:directus_starter/components/editFieldModal.dart';
// import 'package:directus_starter/store/itemController.dart';
import 'package:directus_starter/store/projectsController.dart';
import 'package:directus_starter/store/stepsController.dart';
class Project extends StatelessWidget {
final ProjectController projectController = Get.put(ProjectController());
final ProjectsController projectsController = Get.put(ProjectsController());
final StepsController stepsController = Get.put(StepsController());
@override
@ -17,10 +17,10 @@ class Project extends StatelessWidget {
),
body: Center(
child: Obx(() {
if (!projectController.isFeeded()) {
if (!projectsController.isFeeded()) {
return Text('loading ...');
} else {
var project = projectController.getItemById(Get.parameters['id']);
var project = projectsController.getItemById(Get.parameters['id']);
var steps = stepsController
.getItemsByIds(project['steps'].map((_) => _['id']).toList());
@ -34,7 +34,8 @@ class Project extends StatelessWidget {
Text(project['title']),
TextButton(
onPressed: () => Get.dialog(EditFieldModal(
field: "title", controller: projectController)),
field: "title",
controller: projectsController)),
child: Icon(Icons.edit)),
],
)),
@ -54,7 +55,7 @@ class Project extends StatelessWidget {
'title': 'title created in app',
'project': project['id']
});
projectController.fetch();
projectsController.fetch();
},
child: Text('Create new step'),
)
@ -75,7 +76,7 @@ class Project extends StatelessWidget {
SizedBox(
height: 400,
child: Obx(() {
var project = projectController.getItemById(Get.parameters['id']);
var project = projectsController.getItemById(Get.parameters['id']);
var steps = stepsController
.getItemsByIds(project['steps'].map((_) => _['id']).toList());
return ListView.builder(


+ 0
- 7
pubspec.lock View File

@ -64,13 +64,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
deeply:
dependency: "direct main"
description:
name: deeply
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0+1"
fake_async:
dependency: transitive
description:


+ 1
- 2
pubspec.yaml View File

@ -1,4 +1,4 @@
name: youtribe_lib
name: directus_starter
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
@ -28,7 +28,6 @@ dependencies:
flutter_map: any # or the latest version on Pub
flutter_map_marker_popup: any
localstorage: ^3.0.6+9
deeply: ^1.1.0+1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3


+ 1
- 1
test/widget_test.dart View File

@ -8,7 +8,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:youtribe_lib/main.dart';
import 'package:directus_starter/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {


+ 2
- 2
web/index.html View File

@ -20,13 +20,13 @@
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="youtribe_lib">
<meta name="apple-mobile-web-app-title" content="directus_starter">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<title>youtribe_lib</title>
<title>directus_starter</title>
<link rel="manifest" href="manifest.json">
</head>
<body>


+ 2
- 2
web/manifest.json View File

@ -1,6 +1,6 @@
{
"name": "youtribe_lib",
"short_name": "youtribe_lib",
"name": "directus_starter",
"short_name": "directus_starter",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",


Loading…
Cancel
Save