Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-App
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
ChadCSong
2022-10-31 01:47:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5018f5db7523560642ffce6f8f010065a8039bcc
5018f5db
1 parent
9f86f44b
修改国际化方式,增加multidex支持
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
44 additions
and
44 deletions
android/app/build.gradle
ios/Flutter/Debug.xcconfig
ios/Flutter/Release.xcconfig
lib/login/page/login_page.dart
lib/login/page/register_page.dart
lib/login/page/reset_password_page.dart
lib/login/page/sms_login_page.dart
lib/login/widgets/my_text_field.dart
lib/main.dart
pubspec.lock
pubspec.yaml
android/app/build.gradle
View file @
5018f5d
...
...
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply
from:
"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android
{
compileSdkVersion
3
0
compileSdkVersion
3
3
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
...
...
@@ -46,6 +46,7 @@ android {
applicationId
"com.mofunsky.one_poem"
minSdkVersion
20
targetSdkVersion
30
multiDexEnabled
true
versionCode
flutterVersionCode
.
toInteger
()
versionName
flutterVersionName
}
...
...
ios/Flutter/Debug.xcconfig
View file @
5018f5d
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
...
...
ios/Flutter/Release.xcconfig
View file @
5018f5d
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
...
...
lib/login/page/login_page.dart
View file @
5018f5d
...
...
@@ -2,6 +2,7 @@ import 'package:flustars/flustars.dart';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:one_poem/generated/l10n.dart'
;
import
'package:one_poem/login/widgets/my_text_field.dart'
;
import
'package:one_poem/res/constant.dart'
;
import
'package:one_poem/res/resources.dart'
;
...
...
@@ -15,8 +16,6 @@ import 'package:one_poem/widgets/my_scroll_view.dart';
import
'../login_router.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
/// design/1注册登录/index.html
class
LoginPage
extends
StatefulWidget
{
...
...
@@ -84,7 +83,7 @@ class _LoginPageState extends State<LoginPage> with ChangeNotifierMixin<LoginPag
return
Scaffold
(
appBar:
MyAppBar
(
isBack:
false
,
actionName:
OnePoemLocalizations
.
of
(
context
)
.
verificationCodeLogin
,
actionName:
S
.
current
.
verificationCodeLogin
,
onPressed:
()
{
NavigatorUtils
.
push
(
context
,
LoginRouter
.
smsLoginPage
);
},
...
...
@@ -99,7 +98,7 @@ class _LoginPageState extends State<LoginPage> with ChangeNotifierMixin<LoginPag
List
<
Widget
>
get
_buildBody
=>
<
Widget
>[
Text
(
OnePoemLocalizations
.
of
(
context
).
passwordLogin
,
S
.
of
(
context
).
passwordLogin
,
style:
TextStyles
.
textBold26
,
),
Gaps
.
vGap16
,
...
...
@@ -109,7 +108,7 @@ class _LoginPageState extends State<LoginPage> with ChangeNotifierMixin<LoginPag
controller:
_nameController
,
maxLength:
11
,
keyboardType:
TextInputType
.
phone
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputUsernameHint
,
hintText:
S
.
of
(
context
).
inputUsernameHint
,
),
Gaps
.
vGap8
,
MyTextField
(
...
...
@@ -119,20 +118,20 @@ class _LoginPageState extends State<LoginPage> with ChangeNotifierMixin<LoginPag
isInputPwd:
true
,
controller:
_passwordController
,
keyboardType:
TextInputType
.
visiblePassword
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputPasswordHint
,
hintText:
S
.
of
(
context
).
inputPasswordHint
,
),
Gaps
.
vGap24
,
MyButton
(
key:
const
Key
(
'login'
),
onPressed:
_clickable
?
_login
:
null
,
text:
OnePoemLocalizations
.
of
(
context
).
login
,
text:
S
.
of
(
context
).
login
,
),
Container
(
height:
40.0
,
alignment:
Alignment
.
centerRight
,
child:
GestureDetector
(
child:
Text
(
OnePoemLocalizations
.
of
(
context
).
forgotPasswordLink
,
S
.
of
(
context
).
forgotPasswordLink
,
key:
const
Key
(
'forgotPassword'
),
style:
Theme
.
of
(
context
).
textTheme
.
subtitle2
,
),
...
...
@@ -144,7 +143,7 @@ class _LoginPageState extends State<LoginPage> with ChangeNotifierMixin<LoginPag
alignment:
Alignment
.
center
,
child:
GestureDetector
(
child:
Text
(
OnePoemLocalizations
.
of
(
context
).
noAccountRegisterLink
,
S
.
of
(
context
).
noAccountRegisterLink
,
key:
const
Key
(
'noAccountRegister'
),
style:
TextStyle
(
color:
Theme
.
of
(
context
).
primaryColor
...
...
lib/login/page/register_page.dart
View file @
5018f5d
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:one_poem/generated/l10n.dart'
;
import
'package:one_poem/login/widgets/my_text_field.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/res/styles.dart'
;
...
...
@@ -11,8 +12,6 @@ import 'package:one_poem/widgets/my_app_bar.dart';
import
'package:one_poem/widgets/my_button.dart'
;
import
'package:one_poem/widgets/my_scroll_view.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
/// design/1注册登录/index.html#artboard11
class
RegisterPage
extends
StatefulWidget
{
...
...
@@ -74,7 +73,7 @@ class _RegisterPageState extends State<RegisterPage> with ChangeNotifierMixin<Re
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
MyAppBar
(
title:
OnePoemLocalizations
.
of
(
context
).
register
,
title:
S
.
of
(
context
).
register
,
),
body:
MyScrollView
(
keyboardConfig:
Utils
.
getKeyboardActionsConfig
(
context
,
<
FocusNode
>[
_nodeText1
,
_nodeText2
,
_nodeText3
]),
...
...
@@ -88,7 +87,7 @@ class _RegisterPageState extends State<RegisterPage> with ChangeNotifierMixin<Re
List
<
Widget
>
_buildBody
()
{
return
<
Widget
>[
Text
(
OnePoemLocalizations
.
of
(
context
).
openYourAccount
,
S
.
of
(
context
).
openYourAccount
,
style:
TextStyles
.
textBold26
,
),
Gaps
.
vGap16
,
...
...
@@ -98,7 +97,7 @@ class _RegisterPageState extends State<RegisterPage> with ChangeNotifierMixin<Re
controller:
_nameController
,
maxLength:
11
,
keyboardType:
TextInputType
.
phone
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputPhoneHint
,
hintText:
S
.
of
(
context
).
inputPhoneHint
,
),
Gaps
.
vGap8
,
MyTextField
(
...
...
@@ -108,16 +107,16 @@ class _RegisterPageState extends State<RegisterPage> with ChangeNotifierMixin<Re
keyboardType:
TextInputType
.
number
,
getVCode:
()
async
{
if
(
_nameController
.
text
.
length
==
11
)
{
Toast
.
show
(
OnePoemLocalizations
.
of
(
context
).
verificationButton
);
Toast
.
show
(
S
.
of
(
context
).
verificationButton
);
/// 一般可以在这里发送真正的请求,请求成功返回true
return
true
;
}
else
{
Toast
.
show
(
OnePoemLocalizations
.
of
(
context
).
inputPhoneInvalid
);
Toast
.
show
(
S
.
of
(
context
).
inputPhoneInvalid
);
return
false
;
}
},
maxLength:
6
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputVerificationCodeHint
,
hintText:
S
.
of
(
context
).
inputVerificationCodeHint
,
),
Gaps
.
vGap8
,
MyTextField
(
...
...
@@ -127,13 +126,13 @@ class _RegisterPageState extends State<RegisterPage> with ChangeNotifierMixin<Re
isInputPwd:
true
,
controller:
_passwordController
,
keyboardType:
TextInputType
.
visiblePassword
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputPasswordHint
,
hintText:
S
.
of
(
context
).
inputPasswordHint
,
),
Gaps
.
vGap24
,
MyButton
(
key:
const
Key
(
'register'
),
onPressed:
_clickable
?
_register
:
null
,
text:
OnePoemLocalizations
.
of
(
context
).
register
,
text:
S
.
of
(
context
).
register
,
)
];
}
...
...
lib/login/page/reset_password_page.dart
View file @
5018f5d
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:one_poem/generated/l10n.dart'
;
import
'package:one_poem/login/widgets/my_text_field.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/util/change_notifier_manage.dart'
;
...
...
@@ -9,7 +10,6 @@ import 'package:one_poem/widgets/my_app_bar.dart';
import
'package:one_poem/widgets/my_button.dart'
;
import
'package:one_poem/widgets/my_scroll_view.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
/// design/1注册登录/index.html#artboard9
class
ResetPasswordPage
extends
StatefulWidget
{
...
...
@@ -64,14 +64,14 @@ class _ResetPasswordPageState extends State<ResetPasswordPage> with ChangeNotifi
}
void
_reset
()
{
Toast
.
show
(
OnePoemLocalizations
.
of
(
context
).
confirm
);
Toast
.
show
(
S
.
of
(
context
).
confirm
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
MyAppBar
(
title:
OnePoemLocalizations
.
of
(
context
).
forgotPasswordLink
,
title:
S
.
of
(
context
).
forgotPasswordLink
,
),
body:
MyScrollView
(
keyboardConfig:
Utils
.
getKeyboardActionsConfig
(
context
,
<
FocusNode
>[
_nodeText1
,
_nodeText2
,
_nodeText3
]),
...
...
@@ -85,7 +85,7 @@ class _ResetPasswordPageState extends State<ResetPasswordPage> with ChangeNotifi
List
<
Widget
>
_buildBody
()
{
return
<
Widget
>[
Text
(
OnePoemLocalizations
.
of
(
context
).
resetLoginPassword
,
S
.
of
(
context
).
resetLoginPassword
,
style:
TextStyles
.
textBold26
,
),
Gaps
.
vGap16
,
...
...
@@ -94,7 +94,7 @@ class _ResetPasswordPageState extends State<ResetPasswordPage> with ChangeNotifi
controller:
_nameController
,
maxLength:
11
,
keyboardType:
TextInputType
.
phone
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputPhoneHint
,
hintText:
S
.
of
(
context
).
inputPhoneHint
,
),
Gaps
.
vGap8
,
MyTextField
(
...
...
@@ -105,7 +105,7 @@ class _ResetPasswordPageState extends State<ResetPasswordPage> with ChangeNotifi
return
Future
<
bool
>.
value
(
true
);
},
maxLength:
6
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputVerificationCodeHint
,
hintText:
S
.
of
(
context
).
inputVerificationCodeHint
,
),
Gaps
.
vGap8
,
MyTextField
(
...
...
@@ -113,12 +113,12 @@ class _ResetPasswordPageState extends State<ResetPasswordPage> with ChangeNotifi
isInputPwd:
true
,
controller:
_passwordController
,
keyboardType:
TextInputType
.
visiblePassword
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputPasswordHint
,
hintText:
S
.
of
(
context
).
inputPasswordHint
,
),
Gaps
.
vGap24
,
MyButton
(
onPressed:
_clickable
?
_reset
:
null
,
text:
OnePoemLocalizations
.
of
(
context
).
confirm
,
text:
S
.
of
(
context
).
confirm
,
)
];
}
...
...
lib/login/page/sms_login_page.dart
View file @
5018f5d
...
...
@@ -2,6 +2,7 @@ import 'dart:ui';
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:one_poem/generated/l10n.dart'
;
import
'package:one_poem/login/widgets/my_text_field.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/routers/fluro_navigator.dart'
;
...
...
@@ -13,7 +14,6 @@ import 'package:one_poem/widgets/my_button.dart';
import
'package:one_poem/widgets/my_scroll_view.dart'
;
import
'../login_router.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
/// design/1注册登录/index.html#artboard4
class
SMSLoginPage
extends
StatefulWidget
{
const
SMSLoginPage
({
Key
?
key
})
:
super
(
key:
key
);
...
...
@@ -77,7 +77,7 @@ class _SMSLoginPageState extends State<SMSLoginPage> with ChangeNotifierMixin<SM
List
<
Widget
>
_buildBody
()
{
return
<
Widget
>[
Text
(
OnePoemLocalizations
.
of
(
context
).
verificationCodeLogin
,
S
.
of
(
context
).
verificationCodeLogin
,
style:
TextStyles
.
textBold26
,
),
Gaps
.
vGap16
,
...
...
@@ -86,7 +86,7 @@ class _SMSLoginPageState extends State<SMSLoginPage> with ChangeNotifierMixin<SM
controller:
_phoneController
,
maxLength:
11
,
keyboardType:
TextInputType
.
phone
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputPhoneHint
,
hintText:
S
.
of
(
context
).
inputPhoneHint
,
),
Gaps
.
vGap8
,
MyTextField
(
...
...
@@ -94,9 +94,9 @@ class _SMSLoginPageState extends State<SMSLoginPage> with ChangeNotifierMixin<SM
controller:
_vCodeController
,
maxLength:
6
,
keyboardType:
TextInputType
.
number
,
hintText:
OnePoemLocalizations
.
of
(
context
).
inputVerificationCodeHint
,
hintText:
S
.
of
(
context
).
inputVerificationCodeHint
,
getVCode:
()
{
Toast
.
show
(
OnePoemLocalizations
.
of
(
context
).
getVerificationCode
);
Toast
.
show
(
S
.
of
(
context
).
getVerificationCode
);
return
Future
<
bool
>.
value
(
true
);
},
),
...
...
@@ -105,11 +105,11 @@ class _SMSLoginPageState extends State<SMSLoginPage> with ChangeNotifierMixin<SM
alignment:
Alignment
.
centerLeft
,
child:
RichText
(
text:
TextSpan
(
text:
OnePoemLocalizations
.
of
(
context
).
registeredTips
,
text:
S
.
of
(
context
).
registeredTips
,
style:
Theme
.
of
(
context
).
textTheme
.
subtitle2
?.
copyWith
(
fontSize:
Dimens
.
font_sp14
),
children:
<
TextSpan
>[
TextSpan
(
text:
OnePoemLocalizations
.
of
(
context
).
register
,
text:
S
.
of
(
context
).
register
,
style:
TextStyle
(
color:
Theme
.
of
(
context
).
errorColor
,
),
...
...
@@ -126,14 +126,14 @@ class _SMSLoginPageState extends State<SMSLoginPage> with ChangeNotifierMixin<SM
Gaps
.
vGap24
,
MyButton
(
onPressed:
_clickable
?
_login
:
null
,
text:
OnePoemLocalizations
.
of
(
context
).
login
,
text:
S
.
of
(
context
).
login
,
),
Container
(
height:
40.0
,
alignment:
Alignment
.
centerRight
,
child:
GestureDetector
(
child:
Text
(
OnePoemLocalizations
.
of
(
context
).
forgotPasswordLink
,
S
.
of
(
context
).
forgotPasswordLink
,
style:
Theme
.
of
(
context
).
textTheme
.
subtitle2
,
),
onTap:
()
=>
NavigatorUtils
.
push
(
context
,
LoginRouter
.
resetPasswordPage
),
...
...
lib/login/widgets/my_text_field.dart
View file @
5018f5d
...
...
@@ -3,11 +3,11 @@ import 'dart:async';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:one_poem/generated/l10n.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/util/device_utils.dart'
;
import
'package:one_poem/widgets/load_image.dart'
;
import
'package:one_poem/widgets/my_button.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
/// 登录模块的输入框封装
class
MyTextField
extends
StatefulWidget
{
...
...
@@ -179,7 +179,7 @@ class _MyTextFieldState extends State<MyTextField> {
key:
const
Key
(
'getVerificationCode'
),
onPressed:
_clickable
?
_getVCode
:
null
,
fontSize:
Dimens
.
font_sp12
,
text:
_clickable
?
OnePoemLocalizations
.
of
(
context
).
getVerificationCode
:
'(
$_currentSecond
s)'
,
text:
_clickable
?
S
.
of
(
context
).
getVerificationCode
:
'(
$_currentSecond
s)'
,
textColor:
themeData
.
primaryColor
,
disabledTextColor:
isDark
?
Colours
.
dark_text
:
Colors
.
white
,
backgroundColor:
Colors
.
transparent
,
...
...
lib/main.dart
View file @
5018f5d
...
...
@@ -3,12 +3,11 @@ import 'package:flustars/flustars.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:oktoast/oktoast.dart'
;
import
'package:one_poem/generated/l10n.dart'
;
import
'package:provider/provider.dart'
;
import
'package:quick_actions/quick_actions.dart'
;
import
'package:url_strategy/url_strategy.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
import
'home/splash_page.dart'
;
import
'net/dio_utils.dart'
;
import
'net/intercept.dart'
;
...
...
@@ -154,8 +153,8 @@ class MyApp extends StatelessWidget {
themeMode:
provider
.
getThemeMode
(),
home:
home
??
const
SplashPage
(),
onGenerateRoute:
Routes
.
router
.
generator
,
localizationsDelegates:
OnePoemLocalizations
.
localizationsDelegates
,
supportedLocales:
OnePoemLocalizations
.
supportedLocales
,
localizationsDelegates:
const
[
S
.
delegate
]
,
supportedLocales:
S
.
delegate
.
supportedLocales
,
locale:
localeProvider
.
locale
,
navigatorKey:
navigatorKey
,
builder:
(
BuildContext
context
,
Widget
?
child
)
{
...
...
pubspec.lock
View file @
5018f5d
This diff is collapsed. Click to expand it.
pubspec.yaml
View file @
5018f5d
...
...
@@ -70,7 +70,7 @@ dependencies:
# 状态管理 https://github.com/rrousselGit/provider
provider
:
^6.0.1
# 扫码 https://github.com/juliuscanute/qr_code_scanner
qr_code_scanner
:
0.
6.1
qr_code_scanner
:
0.
7.0
# App Shortcuts https://github.com/flutter/plugins/tree/master/packages/quick_actions
quick_actions
:
^0.6.0+8
# 振动(支持Web) https://github.com/benjamindean/flutter_vibration
...
...
Please
register
or
login
to post a comment