Skip to content

Commit

Permalink
Merge branch 'detalhes-evento'
Browse files Browse the repository at this point in the history
  • Loading branch information
joogps committed Sep 28, 2023
2 parents f0d3991 + ab0a35b commit c636947
Show file tree
Hide file tree
Showing 41 changed files with 1,173 additions and 689 deletions.
10 changes: 10 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PODS:
- fluttertoast (0.0.2):
- Flutter
- Toast
- image_cropper (0.0.4):
- Flutter
- TOCropViewController (~> 2.6.1)
- image_picker_ios (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand All @@ -13,18 +16,21 @@ PODS:
- smart_auth (0.0.1):
- Flutter
- Toast (4.0.0)
- TOCropViewController (2.6.1)

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- smart_auth (from `.symlinks/plugins/smart_auth/ios`)

SPEC REPOS:
trunk:
- Toast
- TOCropViewController

EXTERNAL SOURCES:
Flutter:
Expand All @@ -33,6 +39,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
image_cropper:
:path: ".symlinks/plugins/image_cropper/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
shared_preferences_foundation:
Expand All @@ -44,10 +52,12 @@ SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
image_cropper: a3291c624a953049bc6a02e1f8c8ceb162a24b25
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863

PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189

Expand Down
11 changes: 7 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
Expand Down Expand Up @@ -451,7 +451,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -471,6 +471,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "rolê";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -582,7 +583,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -631,7 +632,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -653,6 +654,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "rolê";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -679,6 +681,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "rolê";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
13 changes: 6 additions & 7 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>To take user profile image</string>
<key>NSMicrophoneUsageDescription</key>
<string>Used to capture audio for image picker plugin</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>To choose user profile image</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand All @@ -47,12 +53,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSCameraUsageDescription</key>
<string>To take user profile image</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>To choose user profile image</string>
<key>NSMicrophoneUsageDescription</key>
<string>Used to capture audio for image picker plugin</string>

</dict>
</plist>
42 changes: 31 additions & 11 deletions lib/features/event_edit/providers/evento_edit_provider.dart
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
import 'package:flutter/cupertino.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:role/features/event_edit/repository/evento_edit_repository.dart';
import 'package:role/features/evento_detail/providers/evento_detail_provider.dart';
import 'package:role/features/evento_list/providers/evento_list_provider.dart';
import 'package:role/models/evento.dart';
import 'package:role/shared/widgets/custom_toast.dart';

class EventoEditProvider extends ChangeNotifier {
bool _loading = false;
late Evento evento;
late EventoDetailProvider eventoDetailProvider;
Evento get evento => eventoDetailProvider.evento;

EventoEditRepository eventoRepository = EventoEditRepository();

late TextEditingController nameController;
late bool changed = false;

bool get loading => _loading;

late FToast fToast;

EventoEditProvider(int id) {
evento = EventoListProvider.shared.evento(id);
EventoEditProvider(EventoDetailProvider eventoDetailProvider) {
this.eventoDetailProvider = eventoDetailProvider;
nameController = TextEditingController(text: evento.name);
nameController.addListener(_textChanged);
fToast = FToast();
}

setLoading(bool loading) async {
_loading = loading;
notifyListeners();
}

updateData(BuildContext context) async {
changed = false;

Expand All @@ -56,6 +50,32 @@ class EventoEditProvider extends ChangeNotifier {
);

notifyListeners();

eventoDetailProvider.get();
}

delete(BuildContext context) {
EventoListProvider.shared.delete(evento);

fToast.init(context);
Widget toast;
if (true) {
toast = CustomToast(
title: "evento excluído",
icon: CupertinoIcons.checkmark,
color: evento.color1);
} else {
toast = CustomToast(
title: "erro ao salvar evento",
icon: CupertinoIcons.xmark,
color: CupertinoColors.systemRed);
}

fToast.showToast(
child: toast,
gravity: ToastGravity.BOTTOM,
toastDuration: Duration(seconds: 3),
);
}

_textChanged() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import 'dart:convert';

import 'package:role/models/evento_theme.dart';

import '../../../shared/utils/api.dart';
import '../../../shared/utils/api_status.dart';
import '../../../models/evento.dart';

class EventoEditRepository {
Future<int?> putEvento(Evento evento) async {
try {
var response = await API().request(
endpoint: "evento", method: "PUT", body: jsonEncode(evento.toJson()));
var response = await API()
.request(endpoint: "evento", method: "PUT", body: evento.toJson());

Map decoded = json.decode(response.response);
print(response.response);
return decoded["affectedRows"];
} catch (e) {
if (e is ApiError) {
Expand Down
Loading

0 comments on commit c636947

Please sign in to comment.