Skip to content

Commit

Permalink
Working
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Ciber committed Aug 29, 2021
1 parent 947aefc commit 140e112
Show file tree
Hide file tree
Showing 25 changed files with 1,403 additions and 26 deletions.
4 changes: 3 additions & 1 deletion lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class App extends StatelessWidget {
}

return MaterialApp(
theme: darkTheme,
theme: lightTheme,
darkTheme: darkTheme,
debugShowCheckedModeBanner: false,
home: const Scaffold(
body: Loading(),
),
Expand Down
4 changes: 3 additions & 1 deletion lib/app/bloc/theme/theme_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ class ThemeState with _$ThemeState {
required ThemeMode themeMode,
}) = _ThemeState;

factory ThemeState.initial() => const ThemeState(themeMode: ThemeMode.dark);
factory ThemeState.initial() => const ThemeState(
themeMode: ThemeMode.dark,
);
}
1 change: 1 addition & 0 deletions lib/app/data/core/core.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export 'exceptions/exceptions.dart';
export 'platform/platform.dart';
export 'result/result.dart';
export 'utils/utils.dart';
1 change: 1 addition & 0 deletions lib/app/data/core/platform/platform.dart
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export 'http_client/http_client.dart';
export 'platform_channels.dart';
42 changes: 42 additions & 0 deletions lib/app/data/core/platform/platform_channels.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:flutter/services.dart';

const platform = MethodChannel('com.cubanopensource.todo');

//! Call
Future<bool?> callTo(String number) async {
return platform.invokeMethod<bool>('callTo', number);
}

//! Show float widget
Future<bool?> getShowWidgetPreference() async {
return platform.invokeMethod('getShowWidgetPreference');
}

Future<void> setTrueShowWidget() async {
await platform.invokeMethod('setTrueShowWidget');
}

Future<void> setFalseShowWidget() async {
await platform.invokeMethod('setFalseShowWidget');
}

//! Turn on/off wifi
Future<bool?> getTurnOffWifiPreference() async {
return platform.invokeMethod('getTurnOffWifiPreference');
}

Future<void> setTrueTurnOffWifi() async {
await platform.invokeMethod('setTrueTurnOffWifi');
}

Future<void> setFalseTurnOffWifi() async {
await platform.invokeMethod('setFalseTurnOffWifi');
}

Future<void> turnOnWifi() async {
await platform.invokeMethod('turnOnWifi');
}

Future<void> turnOffWifi() async {
await platform.invokeMethod('turnOffWifi');
}
9 changes: 9 additions & 0 deletions lib/app/data/core/result/result.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'result.freezed.dart';

@freezed
class Result<T> with _$Result<T> {
const factory Result.success({required T data}) = _Success;
const factory Result.error({required String message}) = _Error;
}
305 changes: 305 additions & 0 deletions lib/app/data/core/result/result.freezed.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions lib/app/data/core/utils/contacts.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:fluttercontactpicker/fluttercontactpicker.dart';

Future<String> getContactPhoneNumber() async {
final contact = await FlutterContactPicker.pickPhoneContact();

return contact.phoneNumber
.toString()
.replaceAll('+53', '')
.replaceAll(' ', '')
.replaceAll(RegExp('([a-zA-Z])'), '')
.replaceAll('()', '');
}
Loading

0 comments on commit 140e112

Please sign in to comment.