414 changed files with 14710 additions and 1 deletions
@ -0,0 +1,6 @@ |
|||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
path_provider=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider-2.0.15\\ |
||||
|
path_provider_android=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_android-2.0.27\\ |
||||
|
path_provider_foundation=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_foundation-2.2.3\\ |
||||
|
path_provider_linux=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_linux-2.1.11\\ |
||||
|
path_provider_windows=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_windows-2.1.7\\ |
||||
@ -0,0 +1 @@ |
|||||
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.2.3\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.2.3\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-2.1.11\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-2.1.7\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-07-14 11:41:46.248683","version":"3.10.5"} |
||||
@ -0,0 +1,30 @@ |
|||||
|
# Miscellaneous |
||||
|
*.class |
||||
|
*.log |
||||
|
*.pyc |
||||
|
*.swp |
||||
|
.DS_Store |
||||
|
.atom/ |
||||
|
.buildlog/ |
||||
|
.history |
||||
|
.svn/ |
||||
|
migrate_working_dir/ |
||||
|
|
||||
|
# IntelliJ related |
||||
|
*.iml |
||||
|
*.ipr |
||||
|
*.iws |
||||
|
.idea/ |
||||
|
|
||||
|
# The .vscode folder contains launch configuration and tasks you configure in |
||||
|
# VS Code which you may wish to be included in version control, so this line |
||||
|
# is commented out by default. |
||||
|
#.vscode/ |
||||
|
|
||||
|
# Flutter/Dart/Pub related |
||||
|
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||
|
/pubspec.lock |
||||
|
**/doc/api/ |
||||
|
.dart_tool/ |
||||
|
.packages |
||||
|
build/ |
||||
@ -0,0 +1,10 @@ |
|||||
|
# 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 and should not be manually edited. |
||||
|
|
||||
|
version: |
||||
|
revision: 796c8ef79279f9c774545b3771238c3098dbefab |
||||
|
channel: stable |
||||
|
|
||||
|
project_type: package |
||||
@ -0,0 +1,3 @@ |
|||||
|
## 0.0.1 |
||||
|
|
||||
|
* TODO: Describe initial release. |
||||
@ -0,0 +1 @@ |
|||||
|
TODO: Add your license here. |
||||
@ -0,0 +1,39 @@ |
|||||
|
<!-- |
||||
|
This README describes the package. If you publish this package to pub.dev, |
||||
|
this README's contents appear on the landing page for your package. |
||||
|
|
||||
|
For information about how to write a good package README, see the guide for |
||||
|
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). |
||||
|
|
||||
|
For general information about developing packages, see the Dart guide for |
||||
|
[creating packages](https://dart.dev/guides/libraries/create-library-packages) |
||||
|
and the Flutter guide for |
||||
|
[developing packages and plugins](https://flutter.dev/developing-packages). |
||||
|
--> |
||||
|
|
||||
|
TODO: Put a short description of the package here that helps potential users |
||||
|
know whether this package might be useful for them. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
TODO: List what your package can do. Maybe include images, gifs, or videos. |
||||
|
|
||||
|
## Getting started |
||||
|
|
||||
|
TODO: List prerequisites and provide or point to information on how to |
||||
|
start using the package. |
||||
|
|
||||
|
## Usage |
||||
|
|
||||
|
TODO: Include short and useful examples for package users. Add longer examples |
||||
|
to `/example` folder. |
||||
|
|
||||
|
```dart |
||||
|
const like = 'sample'; |
||||
|
``` |
||||
|
|
||||
|
## Additional information |
||||
|
|
||||
|
TODO: Tell users more about the package: where to find more information, how to |
||||
|
contribute to the package, how to file issues, what response they can expect |
||||
|
from the package authors, and more. |
||||
@ -0,0 +1,4 @@ |
|||||
|
include: package:flutter_lints/flutter.yaml |
||||
|
|
||||
|
# Additional information about this file can be found at |
||||
|
# https://dart.dev/guides/language/analysis-options |
||||
@ -0,0 +1,25 @@ |
|||||
|
package io.flutter.plugins; |
||||
|
|
||||
|
import io.flutter.plugin.common.PluginRegistry; |
||||
|
import io.flutter.plugins.pathprovider.PathProviderPlugin; |
||||
|
|
||||
|
/** |
||||
|
* Generated file. Do not edit. |
||||
|
*/ |
||||
|
public final class GeneratedPluginRegistrant { |
||||
|
public static void registerWith(PluginRegistry registry) { |
||||
|
if (alreadyRegisteredWith(registry)) { |
||||
|
return; |
||||
|
} |
||||
|
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); |
||||
|
} |
||||
|
|
||||
|
private static boolean alreadyRegisteredWith(PluginRegistry registry) { |
||||
|
final String key = GeneratedPluginRegistrant.class.getCanonicalName(); |
||||
|
if (registry.hasPlugin(key)) { |
||||
|
return true; |
||||
|
} |
||||
|
registry.registrarFor(key); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
sdk.dir=C:\\Users\\eddlevol\\AppData\\Local\\Android\\sdk |
||||
|
flutter.sdk=D:\\Sdk\\Flutter |
||||
@ -0,0 +1,14 @@ |
|||||
|
// This is a generated file; do not edit or check into version control. |
||||
|
FLUTTER_ROOT=D:\Sdk\Flutter |
||||
|
FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\account |
||||
|
COCOAPODS_PARALLEL_CODE_SIGN=true |
||||
|
FLUTTER_TARGET=lib\main.dart |
||||
|
FLUTTER_BUILD_DIR=build |
||||
|
FLUTTER_BUILD_NAME=0.0.1 |
||||
|
FLUTTER_BUILD_NUMBER=0.0.1 |
||||
|
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 |
||||
|
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 |
||||
|
DART_OBFUSCATION=false |
||||
|
TRACK_WIDGET_CREATION=true |
||||
|
TREE_SHAKE_ICONS=false |
||||
|
PACKAGE_CONFIG=.dart_tool/package_config.json |
||||
@ -0,0 +1,13 @@ |
|||||
|
#!/bin/sh |
||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
export "FLUTTER_ROOT=D:\Sdk\Flutter" |
||||
|
export "FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\account" |
||||
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
||||
|
export "FLUTTER_TARGET=lib\main.dart" |
||||
|
export "FLUTTER_BUILD_DIR=build" |
||||
|
export "FLUTTER_BUILD_NAME=0.0.1" |
||||
|
export "FLUTTER_BUILD_NUMBER=0.0.1" |
||||
|
export "DART_OBFUSCATION=false" |
||||
|
export "TRACK_WIDGET_CREATION=true" |
||||
|
export "TREE_SHAKE_ICONS=false" |
||||
|
export "PACKAGE_CONFIG=.dart_tool/package_config.json" |
||||
@ -0,0 +1,19 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#ifndef GeneratedPluginRegistrant_h |
||||
|
#define GeneratedPluginRegistrant_h |
||||
|
|
||||
|
#import <Flutter/Flutter.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface GeneratedPluginRegistrant : NSObject |
||||
|
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry; |
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
||||
|
#endif /* GeneratedPluginRegistrant_h */ |
||||
@ -0,0 +1,21 @@ |
|||||
|
// |
||||
|
// Generated file. Do not edit. |
||||
|
// |
||||
|
|
||||
|
// clang-format off |
||||
|
|
||||
|
#import "GeneratedPluginRegistrant.h" |
||||
|
|
||||
|
#if __has_include(<path_provider_foundation/PathProviderPlugin.h>) |
||||
|
#import <path_provider_foundation/PathProviderPlugin.h> |
||||
|
#else |
||||
|
@import path_provider_foundation; |
||||
|
#endif |
||||
|
|
||||
|
@implementation GeneratedPluginRegistrant |
||||
|
|
||||
|
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry { |
||||
|
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]]; |
||||
|
} |
||||
|
|
||||
|
@end |
||||
@ -0,0 +1,15 @@ |
|||||
|
import 'package:account/pages/route.account.dart'; |
||||
|
import 'package:core/modularity/module.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
|
||||
|
class AccountModule extends Module { |
||||
|
@override |
||||
|
void configureServices() { |
||||
|
inject<AccountModule>(this); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
List<GetPage> get routes => [ |
||||
|
...AccountRoute.routes, |
||||
|
]; |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
export './interceptors/index.dart'; |
||||
|
export './services/index.dart'; |
||||
|
export 'account.module.dart'; |
||||
@ -0,0 +1 @@ |
|||||
|
export 'oauth.api.interceptor.dart'; |
||||
@ -0,0 +1,72 @@ |
|||||
|
|
||||
|
import 'package:core/models/oauth.dart'; |
||||
|
import 'package:core/services/auth.service.dart'; |
||||
|
import 'package:core/services/rest.service.dart'; |
||||
|
import 'package:core/services/session.service.dart'; |
||||
|
import 'package:core/tokens/http.token.dart'; |
||||
|
import 'package:core/utils/string.extensions.dart'; |
||||
|
import 'package:dio/dio.dart'; |
||||
|
|
||||
|
class OAuthApiInterceptor extends Interceptor { |
||||
|
@override |
||||
|
void onRequest(RequestOptions options, RequestInterceptorHandler handler) { |
||||
|
if (!options.extra.containsKey(HttpTokens.ignoreToken)) { |
||||
|
var token = SessionService.to.token; |
||||
|
if (token != null && token.accessToken.isNullOrWhiteSpace() == false) { |
||||
|
var accessToken = token.accessToken; |
||||
|
var scheme = token.tokenType ?? 'Bearer'; |
||||
|
options.headers['Authorization'] = '$scheme $accessToken'; |
||||
|
} |
||||
|
} |
||||
|
return handler.next(options); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
void onError(DioException err, ErrorInterceptorHandler handler) { |
||||
|
// 需要处理401错误 |
||||
|
if (err.response?.statusCode == 401) { |
||||
|
var token = SessionService.to.token; |
||||
|
if (token == null || token.refreshToken.isNullOrWhiteSpace() == true) |
||||
|
{ |
||||
|
return handler.next(err); |
||||
|
} |
||||
|
var authService = AuthService.to; |
||||
|
authService.refreshToken(RefreshTokenParams(token.refreshToken!)) |
||||
|
.then((value) { |
||||
|
SessionService.to.refreshToken(value); |
||||
|
//err.requestOptions |
||||
|
RestService.to.request( |
||||
|
err.requestOptions.path, |
||||
|
data: err.requestOptions.data, |
||||
|
queryParameters: err.requestOptions.queryParameters, |
||||
|
cancelToken: err.requestOptions.cancelToken, |
||||
|
onSendProgress: err.requestOptions.onSendProgress, |
||||
|
onReceiveProgress: err.requestOptions.onReceiveProgress, |
||||
|
options: Options( |
||||
|
method: err.requestOptions.method, |
||||
|
sendTimeout: err.requestOptions.sendTimeout, |
||||
|
receiveTimeout: err.requestOptions.receiveTimeout, |
||||
|
extra: err.requestOptions.extra, |
||||
|
headers: err.requestOptions.headers, |
||||
|
responseType: err.requestOptions.responseType, |
||||
|
contentType: err.requestOptions.contentType, |
||||
|
validateStatus: err.requestOptions.validateStatus, |
||||
|
receiveDataWhenStatusError: err.requestOptions.receiveDataWhenStatusError, |
||||
|
followRedirects: err.requestOptions.followRedirects, |
||||
|
maxRedirects: err.requestOptions.maxRedirects, |
||||
|
persistentConnection: err.requestOptions.persistentConnection, |
||||
|
requestEncoder: err.requestOptions.requestEncoder, |
||||
|
responseDecoder: err.requestOptions.responseDecoder, |
||||
|
listFormat: err.requestOptions.listFormat, |
||||
|
) |
||||
|
).then((value) { |
||||
|
return handler.resolve(value); |
||||
|
}).catchError((_) { |
||||
|
handler.next(err); |
||||
|
}); |
||||
|
}); |
||||
|
} else { |
||||
|
return handler.next(err); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
import 'package:json_annotation/json_annotation.dart'; |
||||
|
|
||||
|
part 'auth.g.dart'; |
||||
|
|
||||
|
@JsonSerializable() |
||||
|
class PortalLoginProvider { |
||||
|
PortalLoginProvider({ |
||||
|
required this.id, |
||||
|
required this.name, |
||||
|
this.logo, |
||||
|
}); |
||||
|
@JsonKey(name: 'Id') |
||||
|
String id; |
||||
|
@JsonKey(name: 'Name') |
||||
|
String name; |
||||
|
@JsonKey(name: 'Logo') |
||||
|
String? logo; |
||||
|
|
||||
|
factory PortalLoginProvider.fromJson(Map<String, dynamic> json) => _$PortalLoginProviderFromJson(json); |
||||
|
Map<String, dynamic> toJson() => _$PortalLoginProviderToJson(this); |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
|
||||
|
part of 'auth.dart'; |
||||
|
|
||||
|
// ************************************************************************** |
||||
|
// JsonSerializableGenerator |
||||
|
// ************************************************************************** |
||||
|
|
||||
|
PortalLoginProvider _$PortalLoginProviderFromJson(Map<String, dynamic> json) => |
||||
|
PortalLoginProvider( |
||||
|
id: json['Id'] as String, |
||||
|
name: json['Name'] as String, |
||||
|
logo: json['Logo'] as String?, |
||||
|
); |
||||
|
|
||||
|
Map<String, dynamic> _$PortalLoginProviderToJson( |
||||
|
PortalLoginProvider instance) => |
||||
|
<String, dynamic>{ |
||||
|
'Id': instance.id, |
||||
|
'Name': instance.name, |
||||
|
'Logo': instance.logo, |
||||
|
}; |
||||
@ -0,0 +1,6 @@ |
|||||
|
import 'auth.dart'; |
||||
|
|
||||
|
class PortalLoginException implements Exception { |
||||
|
PortalLoginException(this.providers); |
||||
|
List<PortalLoginProvider> providers; |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
export './login/index.dart'; |
||||
|
export './user-info/index.dart'; |
||||
@ -0,0 +1,9 @@ |
|||||
|
import 'package:account/pages/login/controller.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
|
||||
|
class LoginBinding extends Bindings { |
||||
|
@override |
||||
|
void dependencies() { |
||||
|
Get.lazyPut(() => LoginController()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,66 @@ |
|||||
|
import 'package:account/models/auth.dart'; |
||||
|
import 'package:account/models/common.dart'; |
||||
|
import 'package:account/pages/login/widget/portal_form.dart'; |
||||
|
import 'package:core/index.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'state.dart'; |
||||
|
|
||||
|
class LoginController extends GetxController { |
||||
|
AuthService get authService => Get.find(); |
||||
|
SessionService get sessionService => Get.find(); |
||||
|
|
||||
|
final Rx<LoginState> _state = Rx<LoginState>(LoginState( |
||||
|
loading: false, |
||||
|
showPassword: false, |
||||
|
portalProviders: [], |
||||
|
)); |
||||
|
LoginState get state => _state.value; |
||||
|
|
||||
|
void changePwdVisiable() { |
||||
|
_state.update((val) { |
||||
|
val?.showPassword = !val.showPassword; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
Future<void> login() async { |
||||
|
await portalLogin(null); |
||||
|
} |
||||
|
|
||||
|
void showPortalLoginDialog() { |
||||
|
Get.defaultDialog( |
||||
|
title: 'Lable:LoginToPortal'.tr, |
||||
|
content: Obx(() => PortalForm( |
||||
|
portalProviders: state.portalProviders, |
||||
|
onSelected: portalLogin, |
||||
|
), |
||||
|
), |
||||
|
barrierDismissible: false, |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
Future<void> portalLogin(PortalLoginProvider? provider) async { |
||||
|
_state.update((val) { |
||||
|
val?.loading = true; |
||||
|
}); |
||||
|
try { |
||||
|
var token = await authService.portal(PortalLoginParams( |
||||
|
enterpriseId: provider?.id, |
||||
|
username: state.username.text, |
||||
|
password: state.password.text)); |
||||
|
sessionService.refreshToken(token); |
||||
|
state.username.clear(); |
||||
|
state.password.clear(); |
||||
|
Get.back(closeOverlays: true); |
||||
|
} on PortalLoginException catch (error) { |
||||
|
_state.update((val) { |
||||
|
val!.portalProviders = error.providers; |
||||
|
}); |
||||
|
showPortalLoginDialog(); |
||||
|
} |
||||
|
finally { |
||||
|
_state.update((val) { |
||||
|
val?.loading = false; |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
export 'binding.dart'; |
||||
|
export 'controller.dart'; |
||||
|
export 'view.dart'; |
||||
@ -0,0 +1,16 @@ |
|||||
|
import 'package:account/models/auth.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
|
||||
|
class LoginState { |
||||
|
LoginState({ |
||||
|
required this.loading, |
||||
|
required this.showPassword, |
||||
|
required this.portalProviders, |
||||
|
}); |
||||
|
bool showPassword; |
||||
|
bool loading; |
||||
|
List<PortalLoginProvider> portalProviders; |
||||
|
|
||||
|
late TextEditingController username = TextEditingController(); |
||||
|
late TextEditingController password = TextEditingController(); |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
|
||||
|
import 'controller.dart'; |
||||
|
import './widget/index.dart'; |
||||
|
|
||||
|
class LoginPage extends GetView<LoginController> { |
||||
|
const LoginPage({super.key}); |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Scaffold( |
||||
|
body: SafeArea( |
||||
|
child: ListView( |
||||
|
children: <Widget>[ |
||||
|
const Logo(), |
||||
|
Obx(() => LoginForm( |
||||
|
state: controller.state, |
||||
|
onSubmit: controller.login, |
||||
|
onPwdVisiable: controller.changePwdVisiable, |
||||
|
)), |
||||
|
const SizedBox(height: 10), |
||||
|
Obx(() => LoginExternal( |
||||
|
state: controller.state, |
||||
|
)), |
||||
|
], |
||||
|
)), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
export './logo.dart'; |
||||
|
export './login_form.dart'; |
||||
|
export './login_external.dart'; |
||||
@ -0,0 +1,37 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
|
||||
|
import '../state.dart'; |
||||
|
|
||||
|
class LoginExternal extends StatelessWidget { |
||||
|
const LoginExternal({ |
||||
|
super.key, |
||||
|
required this.state, |
||||
|
}); |
||||
|
|
||||
|
final LoginState state; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Row( |
||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
|
children: [ |
||||
|
IconButton( |
||||
|
onPressed: () { |
||||
|
|
||||
|
}, |
||||
|
iconSize: 28.0, |
||||
|
color: Colors.green, |
||||
|
icon: const Icon(Icons.wechat), |
||||
|
), |
||||
|
IconButton( |
||||
|
onPressed: () { |
||||
|
|
||||
|
}, |
||||
|
iconSize: 28.0, |
||||
|
color: Colors.teal, |
||||
|
icon: const Icon(Icons.phone_iphone) |
||||
|
), |
||||
|
], |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,173 @@ |
|||||
|
import 'package:core/utils/string.extensions.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
|
||||
|
import '../state.dart'; |
||||
|
|
||||
|
class LoginForm extends StatelessWidget { |
||||
|
LoginForm({ |
||||
|
super.key, |
||||
|
required this.state, |
||||
|
required this.onSubmit, |
||||
|
this.onPwdVisiable, |
||||
|
}); |
||||
|
|
||||
|
final LoginState state; |
||||
|
final Future<void> Function() onSubmit; |
||||
|
final VoidCallback? onPwdVisiable; |
||||
|
|
||||
|
final GlobalKey<FormState> formKey = GlobalKey<FormState>(); |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Column( |
||||
|
crossAxisAlignment: CrossAxisAlignment.start, |
||||
|
children: <Widget> [ |
||||
|
const SizedBox(height: 30), |
||||
|
Padding( |
||||
|
padding: const EdgeInsets.only(left: 25), |
||||
|
child: Column( |
||||
|
children: [ |
||||
|
Text( |
||||
|
'Label:LoginTitle'.tr, |
||||
|
textAlign: TextAlign.left, |
||||
|
style: const TextStyle( |
||||
|
fontSize: 32.0, |
||||
|
fontWeight: FontWeight.w400, |
||||
|
letterSpacing: 0.0, |
||||
|
) |
||||
|
), |
||||
|
Text( |
||||
|
'Label:LoginSubTitle'.tr, |
||||
|
textAlign: TextAlign.left, |
||||
|
style: const TextStyle( |
||||
|
fontSize: 16.0, |
||||
|
fontWeight: FontWeight.w400, |
||||
|
letterSpacing: 0.32, |
||||
|
) |
||||
|
), |
||||
|
], |
||||
|
)), |
||||
|
const SizedBox(height: 30), |
||||
|
Padding( |
||||
|
padding: const EdgeInsets.all(15), |
||||
|
child: Column( |
||||
|
children: <Widget>[ |
||||
|
Form( |
||||
|
key: formKey, |
||||
|
child: Column( |
||||
|
children: <Widget>[ |
||||
|
SizedBox( |
||||
|
height: 40, |
||||
|
child: TextFormField( |
||||
|
textAlignVertical: TextAlignVertical.bottom, |
||||
|
controller: state.username, |
||||
|
decoration: InputDecoration( |
||||
|
hintText: 'Label:UserNameRequired'.tr, |
||||
|
prefixIcon: const Icon(Icons.person), |
||||
|
filled: true, |
||||
|
), |
||||
|
validator: (value) { |
||||
|
if (value.isNullOrWhiteSpace()) { |
||||
|
return 'Label:UserNameRequired'.tr; |
||||
|
} |
||||
|
return null; |
||||
|
}, |
||||
|
), |
||||
|
), |
||||
|
const SizedBox(height: 20), |
||||
|
SizedBox( |
||||
|
height: 40, |
||||
|
child: TextFormField( |
||||
|
textAlignVertical: TextAlignVertical.bottom, |
||||
|
controller: state.password, |
||||
|
decoration: InputDecoration( |
||||
|
hintText: 'Label:PasswordRequired'.tr, |
||||
|
prefixIcon: const Icon(Icons.lock), |
||||
|
suffixIcon: IconButton( |
||||
|
onPressed: onPwdVisiable, |
||||
|
icon: Icon(state.showPassword ? Icons.visibility_off : Icons.visibility, |
||||
|
color: state.showPassword ? Theme.of(context).indicatorColor : Theme.of(context).disabledColor,), |
||||
|
), |
||||
|
filled: true, |
||||
|
), |
||||
|
obscureText: !state.showPassword, |
||||
|
validator: (value) { |
||||
|
if (value.isNullOrWhiteSpace()) { |
||||
|
return 'Label:PasswordRequired'.tr; |
||||
|
} |
||||
|
return null; |
||||
|
}, |
||||
|
), |
||||
|
), |
||||
|
const SizedBox(height: 20), |
||||
|
Row( |
||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
|
children: [ |
||||
|
TextButton( |
||||
|
onPressed: () { |
||||
|
|
||||
|
}, |
||||
|
child: Text('Label:NoAccount'.tr) |
||||
|
), |
||||
|
TextButton( |
||||
|
onPressed: () { |
||||
|
|
||||
|
}, |
||||
|
child: Text('Label:ForgotPassword'.tr) |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
const SizedBox(height: 10), |
||||
|
Padding( |
||||
|
padding: const EdgeInsets.only(left: 8, right: 8, top: 6), |
||||
|
child: SizedBox( |
||||
|
height: 40, |
||||
|
child: Row( |
||||
|
children: [ |
||||
|
Expanded( |
||||
|
child: _loginButton(state.loading), |
||||
|
) |
||||
|
], |
||||
|
), |
||||
|
) |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
) |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
] |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
Widget _loginButton(bool isLoading) { |
||||
|
return IgnorePointer( |
||||
|
ignoring: isLoading, |
||||
|
child: FilledButton( |
||||
|
onPressed: () { |
||||
|
if (formKey.currentState?.validate() == true) { |
||||
|
onSubmit().then((value) { |
||||
|
formKey.currentState?.reset(); |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
style: ButtonStyle( |
||||
|
shape: MaterialStatePropertyAll( |
||||
|
RoundedRectangleBorder( |
||||
|
borderRadius: BorderRadius.circular(12), |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
//shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), |
||||
|
child: Text( |
||||
|
'Label:Login'.tr, |
||||
|
style: const TextStyle( |
||||
|
letterSpacing: 4, |
||||
|
), |
||||
|
) |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
|
||||
|
class Logo extends StatelessWidget { |
||||
|
const Logo({super.key}); |
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Container( |
||||
|
height: 100, |
||||
|
padding: const EdgeInsets.all(8), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
import 'package:account/models/auth.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
|
||||
|
class PortalForm extends StatelessWidget { |
||||
|
const PortalForm({ |
||||
|
super.key, |
||||
|
required this.portalProviders, |
||||
|
this.onSelected, |
||||
|
}); |
||||
|
|
||||
|
final List<PortalLoginProvider> portalProviders; |
||||
|
final void Function(PortalLoginProvider provider)? onSelected; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return SizedBox( |
||||
|
height: 200, |
||||
|
child: ListView( |
||||
|
children: _buildLoginProviders(), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
List<Widget> _buildLoginProviders() { |
||||
|
List<Widget> providers = []; |
||||
|
|
||||
|
for (var provider in portalProviders) { |
||||
|
providers.add(Card( |
||||
|
child: ListTile( |
||||
|
title: Text(provider.name), |
||||
|
leading: const FlutterLogo(), |
||||
|
onTap: () { |
||||
|
onSelected?.call(provider); |
||||
|
}, |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
return providers; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
import 'package:get/get.dart'; |
||||
|
import 'package:core/middlewares/index.dart'; |
||||
|
|
||||
|
import 'index.dart'; |
||||
|
import 'route.name.dart'; |
||||
|
|
||||
|
class AccountRoute { |
||||
|
static List<GetPage> routes = [ |
||||
|
GetPage( |
||||
|
name: AccountRoutes.login, |
||||
|
page: () => const LoginPage(), |
||||
|
binding: LoginBinding(), |
||||
|
), |
||||
|
GetPage( |
||||
|
name: AccountRoutes.profile, |
||||
|
page: () => const UserInfoPage(), |
||||
|
binding: UserInfoBinding(), |
||||
|
middlewares: [AuthorizationMiddleware(AccountRoutes.login)] |
||||
|
), |
||||
|
]; |
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
class AccountRoutes { |
||||
|
static String login = '/account/login'; |
||||
|
static String profile = '/account/profile'; |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
import 'package:get/get.dart'; |
||||
|
import 'controller.dart'; |
||||
|
|
||||
|
class UserInfoBinding extends Bindings { |
||||
|
@override |
||||
|
void dependencies() { |
||||
|
Get.lazyPut(() => UserInfoController()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
import 'package:core/models/auth.dart'; |
||||
|
import 'package:core/services/index.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'state.dart'; |
||||
|
|
||||
|
class UserInfoController extends GetxController { |
||||
|
SessionService get sessionService => Get.find(); |
||||
|
|
||||
|
final Rx<UserInfoState> _state = Rx<UserInfoState>(UserInfoState()); |
||||
|
UserInfoState get state => _state.value; |
||||
|
Token? get token => sessionService.token; |
||||
|
|
||||
|
@override |
||||
|
void onInit() { |
||||
|
super.onInit(); |
||||
|
_state.update((val) { |
||||
|
val!.profile = sessionService.profile; |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
export 'binding.dart'; |
||||
|
export 'controller.dart'; |
||||
|
export 'view.dart'; |
||||
@ -0,0 +1,8 @@ |
|||||
|
import 'package:core/models/auth.dart'; |
||||
|
|
||||
|
class UserInfoState { |
||||
|
UserInfoState({ |
||||
|
this.profile, |
||||
|
}); |
||||
|
UserProfile? profile; |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:components/index.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'controller.dart'; |
||||
|
|
||||
|
class UserInfoPage extends GetView<UserInfoController> { |
||||
|
const UserInfoPage({super.key}); |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Scaffold( |
||||
|
appBar: AppBar( |
||||
|
title: Text('Page:UserProfile'.tr), |
||||
|
), |
||||
|
body: Container( |
||||
|
padding: const EdgeInsets.only(top: 12), |
||||
|
child: Column( |
||||
|
children: [ |
||||
|
/// 主题设置 |
||||
|
_actionButton( |
||||
|
title: 'Avatar'.tr, |
||||
|
suffix: Obx(() => Avatar( |
||||
|
url: controller.state.profile?.avatarUrl, |
||||
|
hintText: controller.state.profile?.userName, |
||||
|
takeToken: controller.token?.accessToken, |
||||
|
)), |
||||
|
), |
||||
|
/// 账号设置 |
||||
|
_actionButton( |
||||
|
title: 'DisplayName:UserName'.tr, |
||||
|
suffix: Obx(() => Text(controller.state.profile?.userName ?? '')), |
||||
|
), |
||||
|
_actionButton( |
||||
|
title: 'DisplayName:Email'.tr, |
||||
|
suffix: Obx(() => Text(controller.state.profile?.email ?? '')), |
||||
|
), |
||||
|
_actionButton( |
||||
|
title: 'DisplayName:PhoneNumber'.tr, |
||||
|
suffix: Obx(() => Text(controller.state.profile?.phoneNumber ?? '')), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
Widget _actionButton( |
||||
|
{ |
||||
|
required String title, |
||||
|
Widget? suffix, |
||||
|
VoidCallback? onTap, |
||||
|
} |
||||
|
) { |
||||
|
return Container( |
||||
|
height: 50, |
||||
|
alignment: Alignment.center, |
||||
|
child: ActionButton( |
||||
|
title: title, |
||||
|
onTap: onTap, |
||||
|
suffix: suffix, |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,105 @@ |
|||||
|
import 'dart:convert'; |
||||
|
|
||||
|
import 'package:account/models/auth.dart'; |
||||
|
import 'package:account/models/common.dart'; |
||||
|
import 'package:core/models/auth.dart'; |
||||
|
import 'package:core/models/oauth.dart'; |
||||
|
import 'package:core/services/index.dart'; |
||||
|
import 'package:core/tokens/http.token.dart'; |
||||
|
import 'package:dio/dio.dart'; |
||||
|
|
||||
|
class OAuthService extends AuthService { |
||||
|
OAuthService({ |
||||
|
required this.clientId, |
||||
|
this.clientSecret, |
||||
|
}); |
||||
|
RestService get _restService => find(); |
||||
|
|
||||
|
final String clientId; |
||||
|
final String? clientSecret; |
||||
|
|
||||
|
@override |
||||
|
Future<Token> password(LoginParams params) { |
||||
|
var request = PasswordTokenRequest( |
||||
|
clientId: clientId, |
||||
|
clientSecret: clientSecret, |
||||
|
userName: params.username, |
||||
|
password: params.password); |
||||
|
return _restService.post('/connect/token', |
||||
|
data: request.toFormUrlencodedData(), |
||||
|
options: Options( |
||||
|
extra: { |
||||
|
HttpTokens.ignoreToken: true, |
||||
|
}, |
||||
|
contentType: 'application/x-www-form-urlencoded', |
||||
|
)).then((res) => Token.fromJson(res.data)); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
Future<Token> portal(PortalLoginParams params) { |
||||
|
var request = PortalTokenRequest( |
||||
|
clientId: clientId, |
||||
|
clientSecret: clientSecret, |
||||
|
userName: params.username, |
||||
|
password: params.password, |
||||
|
enterpriseId: params.enterpriseId); |
||||
|
return _restService.post('/connect/token', |
||||
|
data: request.toFormUrlencodedData(), |
||||
|
options: Options( |
||||
|
extra: { |
||||
|
HttpTokens.ignoreToken: true, |
||||
|
HttpTokens.ignoreError: true, |
||||
|
}, |
||||
|
contentType: 'application/x-www-form-urlencoded', |
||||
|
)).then((res) => Token.fromJson(res.data)) |
||||
|
.catchError((error) { |
||||
|
var portalProviders = (jsonDecode(error.response.data["Enterprises"]) as List<dynamic>) |
||||
|
.map((e) => PortalLoginProvider.fromJson(e)).toList(); |
||||
|
throw PortalLoginException(portalProviders); |
||||
|
}, test:(error) { |
||||
|
var err = error as dynamic; |
||||
|
if (err?.response?.statusCode == 400 && err?.response?.data != null && |
||||
|
err?.response?.data["Enterprises"] != null) { |
||||
|
return true; |
||||
|
} |
||||
|
return false; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
Future<Token> phoneNumber(SmsLoginParams params) { |
||||
|
var request = PhoneNumberTokenRequest( |
||||
|
clientId: clientId, |
||||
|
clientSecret: clientSecret, |
||||
|
phoneNumber: params.phonenumber, |
||||
|
code: params.code); |
||||
|
return _restService.post('/connect/token', |
||||
|
data: request.toFormUrlencodedData(), |
||||
|
options: Options( |
||||
|
extra: { |
||||
|
HttpTokens.ignoreToken: true, |
||||
|
}, |
||||
|
contentType: 'application/x-www-form-urlencoded', |
||||
|
)).then((res) => Token.fromJson(res.data)); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
Future<Token> refreshToken(RefreshTokenParams params) { |
||||
|
var request = RefreshTokenRequest( |
||||
|
clientId: clientId, |
||||
|
clientSecret: clientSecret, |
||||
|
refreshToken: params.refreshToken, |
||||
|
); |
||||
|
return _restService.post('/connect/token', |
||||
|
data: request.toFormUrlencodedData(), |
||||
|
options: Options( |
||||
|
contentType: 'application/x-www-form-urlencoded', |
||||
|
)).then((res) => Token.fromJson(res.data)); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
Future<UserProfile> getProfile() { |
||||
|
return _restService.get('/connect/userinfo') |
||||
|
.then((res) => UserProfile.fromJson(res.data)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
export 'auth.service.oauth.dart'; |
||||
@ -0,0 +1,11 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#include "generated_plugin_registrant.h" |
||||
|
|
||||
|
|
||||
|
void fl_register_plugins(FlPluginRegistry* registry) { |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#ifndef GENERATED_PLUGIN_REGISTRANT_ |
||||
|
#define GENERATED_PLUGIN_REGISTRANT_ |
||||
|
|
||||
|
#include <flutter_linux/flutter_linux.h> |
||||
|
|
||||
|
// Registers Flutter plugins.
|
||||
|
void fl_register_plugins(FlPluginRegistry* registry); |
||||
|
|
||||
|
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||
@ -0,0 +1,23 @@ |
|||||
|
# |
||||
|
# Generated file, do not edit. |
||||
|
# |
||||
|
|
||||
|
list(APPEND FLUTTER_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
set(PLUGIN_BUNDLED_LIBRARIES) |
||||
|
|
||||
|
foreach(plugin ${FLUTTER_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) |
||||
|
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) |
||||
|
endforeach(plugin) |
||||
|
|
||||
|
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) |
||||
|
endforeach(ffi_plugin) |
||||
@ -0,0 +1,11 @@ |
|||||
|
// This is a generated file; do not edit or check into version control. |
||||
|
FLUTTER_ROOT=D:\Sdk\Flutter |
||||
|
FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\account |
||||
|
COCOAPODS_PARALLEL_CODE_SIGN=true |
||||
|
FLUTTER_BUILD_DIR=build |
||||
|
FLUTTER_BUILD_NAME=0.0.1 |
||||
|
FLUTTER_BUILD_NUMBER=0.0.1 |
||||
|
DART_OBFUSCATION=false |
||||
|
TRACK_WIDGET_CREATION=true |
||||
|
TREE_SHAKE_ICONS=false |
||||
|
PACKAGE_CONFIG=.dart_tool/package_config.json |
||||
@ -0,0 +1,12 @@ |
|||||
|
#!/bin/sh |
||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
export "FLUTTER_ROOT=D:\Sdk\Flutter" |
||||
|
export "FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\account" |
||||
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
||||
|
export "FLUTTER_BUILD_DIR=build" |
||||
|
export "FLUTTER_BUILD_NAME=0.0.1" |
||||
|
export "FLUTTER_BUILD_NUMBER=0.0.1" |
||||
|
export "DART_OBFUSCATION=false" |
||||
|
export "TRACK_WIDGET_CREATION=true" |
||||
|
export "TREE_SHAKE_ICONS=false" |
||||
|
export "PACKAGE_CONFIG=.dart_tool/package_config.json" |
||||
@ -0,0 +1,65 @@ |
|||||
|
name: account |
||||
|
description: A new Flutter package project. |
||||
|
version: 0.0.1 |
||||
|
homepage: |
||||
|
publish_to: none |
||||
|
|
||||
|
environment: |
||||
|
sdk: '>=3.0.5 <4.0.0' |
||||
|
flutter: ">=1.17.0" |
||||
|
|
||||
|
dependencies: |
||||
|
flutter: |
||||
|
sdk: flutter |
||||
|
core: |
||||
|
path: '../core' |
||||
|
components: |
||||
|
path: '../components' |
||||
|
dio: |
||||
|
get: |
||||
|
json_annotation: ^4.8.1 |
||||
|
|
||||
|
dev_dependencies: |
||||
|
flutter_test: |
||||
|
sdk: flutter |
||||
|
flutter_lints: ^2.0.0 |
||||
|
|
||||
|
build_runner: ^2.4.5 |
||||
|
json_serializable: ^6.7.0 |
||||
|
|
||||
|
# For information on the generic Dart part of this file, see the |
||||
|
# following page: https://dart.dev/tools/pub/pubspec |
||||
|
|
||||
|
# The following section is specific to Flutter packages. |
||||
|
flutter: |
||||
|
|
||||
|
# To add assets to your package, add an assets section, like this: |
||||
|
# assets: |
||||
|
# - images/a_dot_burr.jpeg |
||||
|
# - images/a_dot_ham.jpeg |
||||
|
# |
||||
|
# For details regarding assets in packages, see |
||||
|
# https://flutter.dev/assets-and-images/#from-packages |
||||
|
# |
||||
|
# An image asset can refer to one or more resolution-specific "variants", see |
||||
|
# https://flutter.dev/assets-and-images/#resolution-aware |
||||
|
|
||||
|
# To add custom fonts to your package, add a fonts section here, |
||||
|
# in this "flutter" section. Each entry in this list should have a |
||||
|
# "family" key with the font family name, and a "fonts" key with a |
||||
|
# list giving the asset and other descriptors for the font. For |
||||
|
# example: |
||||
|
# fonts: |
||||
|
# - family: Schyler |
||||
|
# fonts: |
||||
|
# - asset: fonts/Schyler-Regular.ttf |
||||
|
# - asset: fonts/Schyler-Italic.ttf |
||||
|
# style: italic |
||||
|
# - family: Trajan Pro |
||||
|
# fonts: |
||||
|
# - asset: fonts/TrajanPro.ttf |
||||
|
# - asset: fonts/TrajanPro_Bold.ttf |
||||
|
# weight: 700 |
||||
|
# |
||||
|
# For details regarding fonts in packages, see |
||||
|
# https://flutter.dev/custom-fonts/#from-packages |
||||
@ -0,0 +1,11 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#include "generated_plugin_registrant.h" |
||||
|
|
||||
|
|
||||
|
void RegisterPlugins(flutter::PluginRegistry* registry) { |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#ifndef GENERATED_PLUGIN_REGISTRANT_ |
||||
|
#define GENERATED_PLUGIN_REGISTRANT_ |
||||
|
|
||||
|
#include <flutter/plugin_registry.h> |
||||
|
|
||||
|
// Registers Flutter plugins.
|
||||
|
void RegisterPlugins(flutter::PluginRegistry* registry); |
||||
|
|
||||
|
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||
@ -0,0 +1,23 @@ |
|||||
|
# |
||||
|
# Generated file, do not edit. |
||||
|
# |
||||
|
|
||||
|
list(APPEND FLUTTER_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
set(PLUGIN_BUNDLED_LIBRARIES) |
||||
|
|
||||
|
foreach(plugin ${FLUTTER_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) |
||||
|
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) |
||||
|
endforeach(plugin) |
||||
|
|
||||
|
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) |
||||
|
endforeach(ffi_plugin) |
||||
@ -0,0 +1,6 @@ |
|||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
path_provider=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider-2.0.15\\ |
||||
|
path_provider_android=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_android-2.0.27\\ |
||||
|
path_provider_foundation=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_foundation-2.2.3\\ |
||||
|
path_provider_linux=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_linux-2.1.11\\ |
||||
|
path_provider_windows=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_windows-2.1.7\\ |
||||
@ -0,0 +1 @@ |
|||||
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.2.3\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.2.3\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-2.1.11\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-2.1.7\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-07-16 10:47:15.025132","version":"3.10.5"} |
||||
@ -0,0 +1,30 @@ |
|||||
|
# Miscellaneous |
||||
|
*.class |
||||
|
*.log |
||||
|
*.pyc |
||||
|
*.swp |
||||
|
.DS_Store |
||||
|
.atom/ |
||||
|
.buildlog/ |
||||
|
.history |
||||
|
.svn/ |
||||
|
migrate_working_dir/ |
||||
|
|
||||
|
# IntelliJ related |
||||
|
*.iml |
||||
|
*.ipr |
||||
|
*.iws |
||||
|
.idea/ |
||||
|
|
||||
|
# The .vscode folder contains launch configuration and tasks you configure in |
||||
|
# VS Code which you may wish to be included in version control, so this line |
||||
|
# is commented out by default. |
||||
|
#.vscode/ |
||||
|
|
||||
|
# Flutter/Dart/Pub related |
||||
|
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||
|
/pubspec.lock |
||||
|
**/doc/api/ |
||||
|
.dart_tool/ |
||||
|
.packages |
||||
|
build/ |
||||
@ -0,0 +1,10 @@ |
|||||
|
# 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 and should not be manually edited. |
||||
|
|
||||
|
version: |
||||
|
revision: 796c8ef79279f9c774545b3771238c3098dbefab |
||||
|
channel: stable |
||||
|
|
||||
|
project_type: package |
||||
@ -0,0 +1,3 @@ |
|||||
|
## 0.0.1 |
||||
|
|
||||
|
* TODO: Describe initial release. |
||||
@ -0,0 +1 @@ |
|||||
|
TODO: Add your license here. |
||||
@ -0,0 +1,39 @@ |
|||||
|
<!-- |
||||
|
This README describes the package. If you publish this package to pub.dev, |
||||
|
this README's contents appear on the landing page for your package. |
||||
|
|
||||
|
For information about how to write a good package README, see the guide for |
||||
|
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). |
||||
|
|
||||
|
For general information about developing packages, see the Dart guide for |
||||
|
[creating packages](https://dart.dev/guides/libraries/create-library-packages) |
||||
|
and the Flutter guide for |
||||
|
[developing packages and plugins](https://flutter.dev/developing-packages). |
||||
|
--> |
||||
|
|
||||
|
TODO: Put a short description of the package here that helps potential users |
||||
|
know whether this package might be useful for them. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
TODO: List what your package can do. Maybe include images, gifs, or videos. |
||||
|
|
||||
|
## Getting started |
||||
|
|
||||
|
TODO: List prerequisites and provide or point to information on how to |
||||
|
start using the package. |
||||
|
|
||||
|
## Usage |
||||
|
|
||||
|
TODO: Include short and useful examples for package users. Add longer examples |
||||
|
to `/example` folder. |
||||
|
|
||||
|
```dart |
||||
|
const like = 'sample'; |
||||
|
``` |
||||
|
|
||||
|
## Additional information |
||||
|
|
||||
|
TODO: Tell users more about the package: where to find more information, how to |
||||
|
contribute to the package, how to file issues, what response they can expect |
||||
|
from the package authors, and more. |
||||
@ -0,0 +1,4 @@ |
|||||
|
include: package:flutter_lints/flutter.yaml |
||||
|
|
||||
|
# Additional information about this file can be found at |
||||
|
# https://dart.dev/guides/language/analysis-options |
||||
@ -0,0 +1,25 @@ |
|||||
|
package io.flutter.plugins; |
||||
|
|
||||
|
import io.flutter.plugin.common.PluginRegistry; |
||||
|
import io.flutter.plugins.pathprovider.PathProviderPlugin; |
||||
|
|
||||
|
/** |
||||
|
* Generated file. Do not edit. |
||||
|
*/ |
||||
|
public final class GeneratedPluginRegistrant { |
||||
|
public static void registerWith(PluginRegistry registry) { |
||||
|
if (alreadyRegisteredWith(registry)) { |
||||
|
return; |
||||
|
} |
||||
|
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); |
||||
|
} |
||||
|
|
||||
|
private static boolean alreadyRegisteredWith(PluginRegistry registry) { |
||||
|
final String key = GeneratedPluginRegistrant.class.getCanonicalName(); |
||||
|
if (registry.hasPlugin(key)) { |
||||
|
return true; |
||||
|
} |
||||
|
registry.registrarFor(key); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
sdk.dir=C:\\Users\\eddlevol\\AppData\\Local\\Android\\sdk |
||||
|
flutter.sdk=D:\\Sdk\\Flutter |
||||
@ -0,0 +1,14 @@ |
|||||
|
// This is a generated file; do not edit or check into version control. |
||||
|
FLUTTER_ROOT=D:\Sdk\Flutter |
||||
|
FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\components |
||||
|
COCOAPODS_PARALLEL_CODE_SIGN=true |
||||
|
FLUTTER_TARGET=lib\main.dart |
||||
|
FLUTTER_BUILD_DIR=build |
||||
|
FLUTTER_BUILD_NAME=0.0.1 |
||||
|
FLUTTER_BUILD_NUMBER=0.0.1 |
||||
|
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 |
||||
|
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 |
||||
|
DART_OBFUSCATION=false |
||||
|
TRACK_WIDGET_CREATION=true |
||||
|
TREE_SHAKE_ICONS=false |
||||
|
PACKAGE_CONFIG=.dart_tool/package_config.json |
||||
@ -0,0 +1,13 @@ |
|||||
|
#!/bin/sh |
||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
export "FLUTTER_ROOT=D:\Sdk\Flutter" |
||||
|
export "FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\components" |
||||
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
||||
|
export "FLUTTER_TARGET=lib\main.dart" |
||||
|
export "FLUTTER_BUILD_DIR=build" |
||||
|
export "FLUTTER_BUILD_NAME=0.0.1" |
||||
|
export "FLUTTER_BUILD_NUMBER=0.0.1" |
||||
|
export "DART_OBFUSCATION=false" |
||||
|
export "TRACK_WIDGET_CREATION=true" |
||||
|
export "TREE_SHAKE_ICONS=false" |
||||
|
export "PACKAGE_CONFIG=.dart_tool/package_config.json" |
||||
@ -0,0 +1,19 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#ifndef GeneratedPluginRegistrant_h |
||||
|
#define GeneratedPluginRegistrant_h |
||||
|
|
||||
|
#import <Flutter/Flutter.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface GeneratedPluginRegistrant : NSObject |
||||
|
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry; |
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
||||
|
#endif /* GeneratedPluginRegistrant_h */ |
||||
@ -0,0 +1,21 @@ |
|||||
|
// |
||||
|
// Generated file. Do not edit. |
||||
|
// |
||||
|
|
||||
|
// clang-format off |
||||
|
|
||||
|
#import "GeneratedPluginRegistrant.h" |
||||
|
|
||||
|
#if __has_include(<path_provider_foundation/PathProviderPlugin.h>) |
||||
|
#import <path_provider_foundation/PathProviderPlugin.h> |
||||
|
#else |
||||
|
@import path_provider_foundation; |
||||
|
#endif |
||||
|
|
||||
|
@implementation GeneratedPluginRegistrant |
||||
|
|
||||
|
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry { |
||||
|
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]]; |
||||
|
} |
||||
|
|
||||
|
@end |
||||
@ -0,0 +1,3 @@ |
|||||
|
class AvatarConfig { |
||||
|
static String baseUrl = 'http://127.0.0.1:8080/blob/avatars'; |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
export 'avatar.config.dart'; |
||||
@ -0,0 +1,3 @@ |
|||||
|
export './config/index.dart'; |
||||
|
export './pages/index.dart'; |
||||
|
export './widgets/index.dart'; |
||||
@ -0,0 +1 @@ |
|||||
|
export 'page.base.dart'; |
||||
@ -0,0 +1,9 @@ |
|||||
|
import 'package:core/dependency/index.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
|
||||
|
abstract class BasePage<Bloc> extends GetView<Bloc> { |
||||
|
const BasePage({Key? key}) : super(key: key); |
||||
|
|
||||
|
Bloc get bloc => Injector.instance.get(tag: tag); |
||||
|
} |
||||
@ -0,0 +1,100 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import '../empty/index.dart'; |
||||
|
|
||||
|
class ActionButton extends StatelessWidget { |
||||
|
const ActionButton({ |
||||
|
super.key, |
||||
|
required this.title, |
||||
|
this.prefixIcon, |
||||
|
this.prefixIconColor, |
||||
|
this.splashColor, |
||||
|
this.onTap, |
||||
|
this.suffix, |
||||
|
this.suffixIcon, |
||||
|
this.suffixIconColor, |
||||
|
this.hideBorder = false, |
||||
|
}); |
||||
|
|
||||
|
final String title; |
||||
|
final VoidCallback? onTap; |
||||
|
final Color? splashColor; |
||||
|
final IconData? prefixIcon; |
||||
|
final Color? prefixIconColor; |
||||
|
final Widget? suffix; |
||||
|
final IconData? suffixIcon; |
||||
|
final Color? suffixIconColor; |
||||
|
final bool? hideBorder; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return InkWell( |
||||
|
onTap: onTap, |
||||
|
splashColor: splashColor, |
||||
|
child: Container( |
||||
|
decoration: BoxDecoration( |
||||
|
border: hideBorder != true ? const Border( |
||||
|
bottom: BorderSide( |
||||
|
width: 0.2, |
||||
|
style: BorderStyle.solid, |
||||
|
), |
||||
|
// top: BorderSide( |
||||
|
// width: 0.2, |
||||
|
// style: BorderStyle.solid, |
||||
|
// ), |
||||
|
) : null, |
||||
|
), |
||||
|
child: Stack( |
||||
|
children: [ |
||||
|
prefixIcon != null ? |
||||
|
Positioned( |
||||
|
left: 10, |
||||
|
top: 12, |
||||
|
width: 20, |
||||
|
height: 25, |
||||
|
child: Center( |
||||
|
child: Icon(prefixIcon, |
||||
|
size: 25, |
||||
|
color: prefixIconColor |
||||
|
), |
||||
|
), |
||||
|
) : const Empty( |
||||
|
height: 50, |
||||
|
), |
||||
|
Positioned( |
||||
|
left: prefixIcon != null ? 50 : 16, |
||||
|
height: 50, |
||||
|
child: Center( |
||||
|
child: Text( |
||||
|
title, |
||||
|
style: const TextStyle( |
||||
|
fontSize: 16, |
||||
|
fontWeight: FontWeight.w400, |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
suffix == null ? const Empty() : |
||||
|
Positioned( |
||||
|
height: 50, |
||||
|
right: 36, |
||||
|
child: Center( |
||||
|
child: suffix!, |
||||
|
), |
||||
|
), |
||||
|
Positioned( |
||||
|
height: 50, |
||||
|
right: 10, |
||||
|
child: Center( |
||||
|
child: Icon( |
||||
|
suffixIcon ?? Icons.arrow_forward_ios, |
||||
|
size: 16, |
||||
|
color: suffixIconColor, |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
import 'package:core/utils/string.extensions.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:components/config/avatar.config.dart'; |
||||
|
|
||||
|
class Avatar extends StatelessWidget { |
||||
|
const Avatar({ |
||||
|
super.key, |
||||
|
this.url, |
||||
|
this.schema, |
||||
|
this.hintText, |
||||
|
this.takeToken, |
||||
|
}); |
||||
|
|
||||
|
final String? url; |
||||
|
final String? hintText; |
||||
|
final String? schema; |
||||
|
final String? takeToken; |
||||
|
|
||||
|
String get avatarUrl { |
||||
|
var formatUrl = url ?? ''; |
||||
|
if (!formatUrl.isNullOrWhiteSpace()) { |
||||
|
var urlSchema = schema ?? AvatarConfig.baseUrl; |
||||
|
if (!formatUrl.startsWith(urlSchema)) { |
||||
|
formatUrl = "$urlSchema$formatUrl"; |
||||
|
} |
||||
|
} |
||||
|
if (!takeToken.isNullOrWhiteSpace()) { |
||||
|
formatUrl += "?access_token=$takeToken"; |
||||
|
} |
||||
|
return formatUrl; |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return CircleAvatar( |
||||
|
child: !url.isNullOrWhiteSpace() |
||||
|
? CircleAvatar( |
||||
|
backgroundImage: NetworkImage(avatarUrl), |
||||
|
) |
||||
|
: Text(!hintText.isNullOrWhiteSpace() && hintText!.length > 3 ? hintText!.substring(0, 3) : hintText ?? 'A', |
||||
|
style: const TextStyle( |
||||
|
//fontSize: 20, |
||||
|
color: Colors.white, |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,72 @@ |
|||||
|
import 'package:core/utils/theme.utils.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
|
||||
|
class BottomButton extends StatelessWidget { |
||||
|
const BottomButton({ |
||||
|
super.key, |
||||
|
this.padding, |
||||
|
required this.title, |
||||
|
this.titleStyle, |
||||
|
required this.onPressed, |
||||
|
this.enable = true, |
||||
|
}); |
||||
|
|
||||
|
final String title; |
||||
|
final TextStyle? titleStyle; |
||||
|
final VoidCallback onPressed; |
||||
|
final EdgeInsetsGeometry? padding; |
||||
|
final bool enable; |
||||
|
|
||||
|
final EdgeInsetsGeometry _defaultPadding = const EdgeInsets.only(left: 0, right: 0); |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Padding( |
||||
|
padding: padding ?? _defaultPadding, |
||||
|
child: Row( |
||||
|
children: [ |
||||
|
_buildMainButtonPane(context), |
||||
|
], |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
Widget _buildMainButtonPane(BuildContext context) { |
||||
|
return Expanded( |
||||
|
child: GestureDetector( |
||||
|
onTap: () { |
||||
|
if (enable == true) { |
||||
|
onPressed(); |
||||
|
} |
||||
|
}, |
||||
|
child: Container( |
||||
|
height: 48, |
||||
|
padding: const EdgeInsets.only(left: 8, right: 8, top: 6, bottom: 6), |
||||
|
decoration: BoxDecoration( |
||||
|
color: enable |
||||
|
? ThemeUtils.currentColor.primaryContainer |
||||
|
: ThemeUtils.currentTheme.disabledColor, |
||||
|
borderRadius: const BorderRadius.all(Radius.circular(12.0)), |
||||
|
), |
||||
|
child: Center( |
||||
|
child: Text( |
||||
|
title, |
||||
|
style: TextStyle( |
||||
|
fontSize: 16.0, |
||||
|
fontWeight: FontWeight.w600, |
||||
|
letterSpacing: 2, |
||||
|
color: enable |
||||
|
? Colors.white |
||||
|
: ThemeUtils.currentColor.inversePrimary.withOpacity(0.7), |
||||
|
).merge(titleStyle), |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
// child: Text( |
||||
|
// title, |
||||
|
// style: titleStyle, |
||||
|
// ), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
import 'package:flutter/widgets.dart'; |
||||
|
|
||||
|
class Empty extends StatelessWidget { |
||||
|
const Empty({ |
||||
|
super.key, |
||||
|
this.width, |
||||
|
this.height, |
||||
|
this.margin, |
||||
|
this.padding, |
||||
|
this.child, |
||||
|
this.alignment, |
||||
|
this.decoration, |
||||
|
this.foregroundDecoration, |
||||
|
this.transformAlignment, |
||||
|
}); |
||||
|
|
||||
|
final Widget? child; |
||||
|
final double? width; |
||||
|
final double? height; |
||||
|
final EdgeInsetsGeometry? margin; |
||||
|
final EdgeInsetsGeometry? padding; |
||||
|
final AlignmentGeometry? alignment; |
||||
|
final AlignmentGeometry? transformAlignment; |
||||
|
final Decoration? decoration; |
||||
|
final Decoration? foregroundDecoration; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Container( |
||||
|
width: width, |
||||
|
height: height, |
||||
|
margin: margin, |
||||
|
padding: padding, |
||||
|
alignment: alignment, |
||||
|
decoration: decoration, |
||||
|
foregroundDecoration: foregroundDecoration, |
||||
|
transformAlignment: transformAlignment, |
||||
|
child: child, |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
static Empty get none { |
||||
|
return const Empty(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
export 'avatar/index.dart'; |
||||
|
export 'action-button/index.dart'; |
||||
|
export 'bottom-button/index.dart'; |
||||
|
export 'empty/index.dart'; |
||||
@ -0,0 +1,11 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#include "generated_plugin_registrant.h" |
||||
|
|
||||
|
|
||||
|
void fl_register_plugins(FlPluginRegistry* registry) { |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#ifndef GENERATED_PLUGIN_REGISTRANT_ |
||||
|
#define GENERATED_PLUGIN_REGISTRANT_ |
||||
|
|
||||
|
#include <flutter_linux/flutter_linux.h> |
||||
|
|
||||
|
// Registers Flutter plugins.
|
||||
|
void fl_register_plugins(FlPluginRegistry* registry); |
||||
|
|
||||
|
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||
@ -0,0 +1,23 @@ |
|||||
|
# |
||||
|
# Generated file, do not edit. |
||||
|
# |
||||
|
|
||||
|
list(APPEND FLUTTER_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
set(PLUGIN_BUNDLED_LIBRARIES) |
||||
|
|
||||
|
foreach(plugin ${FLUTTER_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) |
||||
|
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) |
||||
|
endforeach(plugin) |
||||
|
|
||||
|
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) |
||||
|
endforeach(ffi_plugin) |
||||
@ -0,0 +1,11 @@ |
|||||
|
// This is a generated file; do not edit or check into version control. |
||||
|
FLUTTER_ROOT=D:\Sdk\Flutter |
||||
|
FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\components |
||||
|
COCOAPODS_PARALLEL_CODE_SIGN=true |
||||
|
FLUTTER_BUILD_DIR=build |
||||
|
FLUTTER_BUILD_NAME=0.0.1 |
||||
|
FLUTTER_BUILD_NUMBER=0.0.1 |
||||
|
DART_OBFUSCATION=false |
||||
|
TRACK_WIDGET_CREATION=true |
||||
|
TREE_SHAKE_ICONS=false |
||||
|
PACKAGE_CONFIG=.dart_tool/package_config.json |
||||
@ -0,0 +1,12 @@ |
|||||
|
#!/bin/sh |
||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
export "FLUTTER_ROOT=D:\Sdk\Flutter" |
||||
|
export "FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\components" |
||||
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
||||
|
export "FLUTTER_BUILD_DIR=build" |
||||
|
export "FLUTTER_BUILD_NAME=0.0.1" |
||||
|
export "FLUTTER_BUILD_NUMBER=0.0.1" |
||||
|
export "DART_OBFUSCATION=false" |
||||
|
export "TRACK_WIDGET_CREATION=true" |
||||
|
export "TREE_SHAKE_ICONS=false" |
||||
|
export "PACKAGE_CONFIG=.dart_tool/package_config.json" |
||||
@ -0,0 +1,58 @@ |
|||||
|
name: components |
||||
|
description: A new Flutter package project. |
||||
|
version: 0.0.1 |
||||
|
homepage: |
||||
|
publish_to: none |
||||
|
|
||||
|
environment: |
||||
|
sdk: '>=3.0.5 <4.0.0' |
||||
|
flutter: ">=1.17.0" |
||||
|
|
||||
|
dependencies: |
||||
|
flutter: |
||||
|
sdk: flutter |
||||
|
core: |
||||
|
path: '../core' |
||||
|
get: |
||||
|
|
||||
|
dev_dependencies: |
||||
|
flutter_test: |
||||
|
sdk: flutter |
||||
|
flutter_lints: ^2.0.0 |
||||
|
|
||||
|
# For information on the generic Dart part of this file, see the |
||||
|
# following page: https://dart.dev/tools/pub/pubspec |
||||
|
|
||||
|
# The following section is specific to Flutter packages. |
||||
|
flutter: |
||||
|
|
||||
|
# To add assets to your package, add an assets section, like this: |
||||
|
# assets: |
||||
|
# - images/a_dot_burr.jpeg |
||||
|
# - images/a_dot_ham.jpeg |
||||
|
# |
||||
|
# For details regarding assets in packages, see |
||||
|
# https://flutter.dev/assets-and-images/#from-packages |
||||
|
# |
||||
|
# An image asset can refer to one or more resolution-specific "variants", see |
||||
|
# https://flutter.dev/assets-and-images/#resolution-aware |
||||
|
|
||||
|
# To add custom fonts to your package, add a fonts section here, |
||||
|
# in this "flutter" section. Each entry in this list should have a |
||||
|
# "family" key with the font family name, and a "fonts" key with a |
||||
|
# list giving the asset and other descriptors for the font. For |
||||
|
# example: |
||||
|
# fonts: |
||||
|
# - family: Schyler |
||||
|
# fonts: |
||||
|
# - asset: fonts/Schyler-Regular.ttf |
||||
|
# - asset: fonts/Schyler-Italic.ttf |
||||
|
# style: italic |
||||
|
# - family: Trajan Pro |
||||
|
# fonts: |
||||
|
# - asset: fonts/TrajanPro.ttf |
||||
|
# - asset: fonts/TrajanPro_Bold.ttf |
||||
|
# weight: 700 |
||||
|
# |
||||
|
# For details regarding fonts in packages, see |
||||
|
# https://flutter.dev/custom-fonts/#from-packages |
||||
@ -0,0 +1,11 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#include "generated_plugin_registrant.h" |
||||
|
|
||||
|
|
||||
|
void RegisterPlugins(flutter::PluginRegistry* registry) { |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#ifndef GENERATED_PLUGIN_REGISTRANT_ |
||||
|
#define GENERATED_PLUGIN_REGISTRANT_ |
||||
|
|
||||
|
#include <flutter/plugin_registry.h> |
||||
|
|
||||
|
// Registers Flutter plugins.
|
||||
|
void RegisterPlugins(flutter::PluginRegistry* registry); |
||||
|
|
||||
|
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||
@ -0,0 +1,23 @@ |
|||||
|
# |
||||
|
# Generated file, do not edit. |
||||
|
# |
||||
|
|
||||
|
list(APPEND FLUTTER_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST |
||||
|
) |
||||
|
|
||||
|
set(PLUGIN_BUNDLED_LIBRARIES) |
||||
|
|
||||
|
foreach(plugin ${FLUTTER_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) |
||||
|
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) |
||||
|
endforeach(plugin) |
||||
|
|
||||
|
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) |
||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) |
||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) |
||||
|
endforeach(ffi_plugin) |
||||
@ -0,0 +1,6 @@ |
|||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
path_provider=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider-2.0.15\\ |
||||
|
path_provider_android=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_android-2.0.27\\ |
||||
|
path_provider_foundation=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_foundation-2.2.3\\ |
||||
|
path_provider_linux=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_linux-2.1.11\\ |
||||
|
path_provider_windows=C:\\Users\\eddlevol\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_windows-2.1.7\\ |
||||
@ -0,0 +1 @@ |
|||||
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.2.3\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.2.3\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-2.1.11\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\eddlevol\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-2.1.7\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-07-16 08:23:33.451996","version":"3.10.5"} |
||||
@ -0,0 +1,30 @@ |
|||||
|
# Miscellaneous |
||||
|
*.class |
||||
|
*.log |
||||
|
*.pyc |
||||
|
*.swp |
||||
|
.DS_Store |
||||
|
.atom/ |
||||
|
.buildlog/ |
||||
|
.history |
||||
|
.svn/ |
||||
|
migrate_working_dir/ |
||||
|
|
||||
|
# IntelliJ related |
||||
|
*.iml |
||||
|
*.ipr |
||||
|
*.iws |
||||
|
.idea/ |
||||
|
|
||||
|
# The .vscode folder contains launch configuration and tasks you configure in |
||||
|
# VS Code which you may wish to be included in version control, so this line |
||||
|
# is commented out by default. |
||||
|
#.vscode/ |
||||
|
|
||||
|
# Flutter/Dart/Pub related |
||||
|
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||
|
/pubspec.lock |
||||
|
**/doc/api/ |
||||
|
.dart_tool/ |
||||
|
.packages |
||||
|
build/ |
||||
@ -0,0 +1,10 @@ |
|||||
|
# 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 and should not be manually edited. |
||||
|
|
||||
|
version: |
||||
|
revision: 796c8ef79279f9c774545b3771238c3098dbefab |
||||
|
channel: stable |
||||
|
|
||||
|
project_type: package |
||||
@ -0,0 +1,3 @@ |
|||||
|
## 0.0.1 |
||||
|
|
||||
|
* TODO: Describe initial release. |
||||
@ -0,0 +1 @@ |
|||||
|
TODO: Add your license here. |
||||
@ -0,0 +1,39 @@ |
|||||
|
<!-- |
||||
|
This README describes the package. If you publish this package to pub.dev, |
||||
|
this README's contents appear on the landing page for your package. |
||||
|
|
||||
|
For information about how to write a good package README, see the guide for |
||||
|
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). |
||||
|
|
||||
|
For general information about developing packages, see the Dart guide for |
||||
|
[creating packages](https://dart.dev/guides/libraries/create-library-packages) |
||||
|
and the Flutter guide for |
||||
|
[developing packages and plugins](https://flutter.dev/developing-packages). |
||||
|
--> |
||||
|
|
||||
|
TODO: Put a short description of the package here that helps potential users |
||||
|
know whether this package might be useful for them. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
TODO: List what your package can do. Maybe include images, gifs, or videos. |
||||
|
|
||||
|
## Getting started |
||||
|
|
||||
|
TODO: List prerequisites and provide or point to information on how to |
||||
|
start using the package. |
||||
|
|
||||
|
## Usage |
||||
|
|
||||
|
TODO: Include short and useful examples for package users. Add longer examples |
||||
|
to `/example` folder. |
||||
|
|
||||
|
```dart |
||||
|
const like = 'sample'; |
||||
|
``` |
||||
|
|
||||
|
## Additional information |
||||
|
|
||||
|
TODO: Tell users more about the package: where to find more information, how to |
||||
|
contribute to the package, how to file issues, what response they can expect |
||||
|
from the package authors, and more. |
||||
@ -0,0 +1,4 @@ |
|||||
|
include: package:flutter_lints/flutter.yaml |
||||
|
|
||||
|
# Additional information about this file can be found at |
||||
|
# https://dart.dev/guides/language/analysis-options |
||||
@ -0,0 +1,25 @@ |
|||||
|
package io.flutter.plugins; |
||||
|
|
||||
|
import io.flutter.plugin.common.PluginRegistry; |
||||
|
import io.flutter.plugins.pathprovider.PathProviderPlugin; |
||||
|
|
||||
|
/** |
||||
|
* Generated file. Do not edit. |
||||
|
*/ |
||||
|
public final class GeneratedPluginRegistrant { |
||||
|
public static void registerWith(PluginRegistry registry) { |
||||
|
if (alreadyRegisteredWith(registry)) { |
||||
|
return; |
||||
|
} |
||||
|
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); |
||||
|
} |
||||
|
|
||||
|
private static boolean alreadyRegisteredWith(PluginRegistry registry) { |
||||
|
final String key = GeneratedPluginRegistrant.class.getCanonicalName(); |
||||
|
if (registry.hasPlugin(key)) { |
||||
|
return true; |
||||
|
} |
||||
|
registry.registrarFor(key); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
sdk.dir=C:\\Users\\eddlevol\\AppData\\Local\\Android\\sdk |
||||
|
flutter.sdk=D:\\Sdk\\Flutter |
||||
@ -0,0 +1,14 @@ |
|||||
|
// This is a generated file; do not edit or check into version control. |
||||
|
FLUTTER_ROOT=D:\Sdk\Flutter |
||||
|
FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\core |
||||
|
COCOAPODS_PARALLEL_CODE_SIGN=true |
||||
|
FLUTTER_TARGET=lib\main.dart |
||||
|
FLUTTER_BUILD_DIR=build |
||||
|
FLUTTER_BUILD_NAME=0.0.1 |
||||
|
FLUTTER_BUILD_NUMBER=0.0.1 |
||||
|
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 |
||||
|
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 |
||||
|
DART_OBFUSCATION=false |
||||
|
TRACK_WIDGET_CREATION=true |
||||
|
TREE_SHAKE_ICONS=false |
||||
|
PACKAGE_CONFIG=.dart_tool/package_config.json |
||||
@ -0,0 +1,13 @@ |
|||||
|
#!/bin/sh |
||||
|
# This is a generated file; do not edit or check into version control. |
||||
|
export "FLUTTER_ROOT=D:\Sdk\Flutter" |
||||
|
export "FLUTTER_APPLICATION_PATH=D:\Projects\Flutter\packages\core" |
||||
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
||||
|
export "FLUTTER_TARGET=lib\main.dart" |
||||
|
export "FLUTTER_BUILD_DIR=build" |
||||
|
export "FLUTTER_BUILD_NAME=0.0.1" |
||||
|
export "FLUTTER_BUILD_NUMBER=0.0.1" |
||||
|
export "DART_OBFUSCATION=false" |
||||
|
export "TRACK_WIDGET_CREATION=true" |
||||
|
export "TREE_SHAKE_ICONS=false" |
||||
|
export "PACKAGE_CONFIG=.dart_tool/package_config.json" |
||||
@ -0,0 +1,19 @@ |
|||||
|
//
|
||||
|
// Generated file. Do not edit.
|
||||
|
//
|
||||
|
|
||||
|
// clang-format off
|
||||
|
|
||||
|
#ifndef GeneratedPluginRegistrant_h |
||||
|
#define GeneratedPluginRegistrant_h |
||||
|
|
||||
|
#import <Flutter/Flutter.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface GeneratedPluginRegistrant : NSObject |
||||
|
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry; |
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
||||
|
#endif /* GeneratedPluginRegistrant_h */ |
||||
@ -0,0 +1,21 @@ |
|||||
|
// |
||||
|
// Generated file. Do not edit. |
||||
|
// |
||||
|
|
||||
|
// clang-format off |
||||
|
|
||||
|
#import "GeneratedPluginRegistrant.h" |
||||
|
|
||||
|
#if __has_include(<path_provider_foundation/PathProviderPlugin.h>) |
||||
|
#import <path_provider_foundation/PathProviderPlugin.h> |
||||
|
#else |
||||
|
@import path_provider_foundation; |
||||
|
#endif |
||||
|
|
||||
|
@implementation GeneratedPluginRegistrant |
||||
|
|
||||
|
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry { |
||||
|
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]]; |
||||
|
} |
||||
|
|
||||
|
@end |
||||
@ -0,0 +1,13 @@ |
|||||
|
abstract class CloneObject<T> { |
||||
|
T clone(); |
||||
|
|
||||
|
T cloneWith(Function(T) update) { |
||||
|
var obj = clone(); |
||||
|
update(obj); |
||||
|
return obj; |
||||
|
} |
||||
|
|
||||
|
void deepWith(Function(T) update) { |
||||
|
update(this as T); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
export 'copy.with.dart'; |
||||
|
export 'logging.dart'; |
||||
@ -0,0 +1,14 @@ |
|||||
|
abstract class ILogger { |
||||
|
|
||||
|
void debug(dynamic message, [dynamic error, StackTrace? stackTrace]); |
||||
|
|
||||
|
void info(dynamic message, [dynamic error, StackTrace? stackTrace]); |
||||
|
|
||||
|
void warn(dynamic message, [dynamic error, StackTrace? stackTrace]); |
||||
|
|
||||
|
void error(dynamic message, [dynamic error, StackTrace? stackTrace]); |
||||
|
|
||||
|
void trace(dynamic message, [dynamic error, StackTrace? stackTrace]); |
||||
|
|
||||
|
void all(dynamic message, [dynamic error, StackTrace? stackTrace]); |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue