feat(client): C 端 1-2 账号链路(邮箱登录/注册 + 令牌与 401 + 匿名/登录分叉)
为什么:客户端此前完全没有账号概念(mine 页的"登录"只是本地 demo 开关), 而受限动作(收藏/评论)要对到具体账号。本批把账号链路接上,为后续互动、进度同步、下载打底。 - AuthApi + AuthController + AuthSessionStore:注册/登录/登出/刷新,令牌与设备号存 shared_preferences (用 SharedPreferencesAsync,与 engagement 仓库同一套 API) - ApiClient:统一带 Authorization 与 X-Device-Id;401 自动刷新一次并重试,刷新失败清登录态走 onUnauthorized - 登录/注册页(pages/auth,沿用 binding/logic/view 与现有视觉):邮箱格式、密码 8-64 位含字母数字本地先校验, 错误提示走 l10n;登录/注册一键切换 - 匿名/登录分叉:首页、发现、详情保持匿名可看;收藏/点赞等受限动作走 ensureSignedIn() 弹底部提示引导登录 - mine 页展示真实账号(昵称 + uid),拿不到才回落到演示文案 - 测试:新增 auth 控制器(注册落盘/401 刷新重试/刷新失败清会话/登出)与登录页(校验/切换)用例; widget_test 改为预置本地会话(账号不再是本地开关);修掉 playback 用例对 host 大小写的环境依赖断言 门禁:flutter analyze 0 问题;flutter test 148 全过。
This commit is contained in:
1 parent
77d5748dbb
commit
e1b98df509
24 files changed
+2871
-1016
No files matched your search
@@ -0,0 +1,6 @@
|
||||
import 'auth_logic.dart';
|
||||
|
||||
/// 与其它页保持一致的三层写法:binding 负责装配,logic 放状态与逻辑,view 只渲染。
|
||||
class AuthBinding {
|
||||
AuthLogic create({bool signUpMode = false}) => AuthLogic(signUpMode: signUpMode);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/// 登录 / 注册页的表单状态与提交逻辑。
|
||||
///
|
||||
/// 校验规则与后端一致(邮箱格式、密码 8-64 位且含字母数字),本地先拦一次是为了少一次网络往返、
|
||||
/// 也让用户立刻看到哪个字段不合格;后端仍会再校验一遍(前端校验不作为安全边界)。
|
||||
class AuthLogic {
|
||||
bool signUpMode;
|
||||
String email = '';
|
||||
String password = '';
|
||||
bool busy = false;
|
||||
String? errorMessage;
|
||||
|
||||
AuthLogic({this.signUpMode = false, this.errorMessage});
|
||||
|
||||
void toggleMode() {
|
||||
signUpMode = !signUpMode;
|
||||
errorMessage = null;
|
||||
}
|
||||
|
||||
/// 返回 null 表示校验通过,否则返回错误文案(由视图用 l10n 映射)
|
||||
AuthFieldError? validate() {
|
||||
final mail = email.trim();
|
||||
if (mail.isEmpty) return AuthFieldError.emailRequired;
|
||||
if (!_emailPattern.hasMatch(mail)) return AuthFieldError.emailInvalid;
|
||||
if (password.isEmpty) return AuthFieldError.passwordRequired;
|
||||
if (password.length < 8 || password.length > 64) {
|
||||
return AuthFieldError.passwordLength;
|
||||
}
|
||||
if (!_hasLetter.hasMatch(password) || !_hasDigit.hasMatch(password)) {
|
||||
return AuthFieldError.passwordWeak;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String get normalizedEmail => email.trim().toLowerCase();
|
||||
|
||||
static final _emailPattern = RegExp(
|
||||
r'^[A-Za-z0-9._%+\-]{1,64}@[A-Za-z0-9]([A-Za-z0-9\-]{0,61}[A-Za-z0-9])?'
|
||||
r'(\.[A-Za-z0-9]([A-Za-z0-9\-]{0,61}[A-Za-z0-9])?)*\.[A-Za-z]{2,}$',
|
||||
);
|
||||
static final _hasLetter = RegExp('[A-Za-z]');
|
||||
static final _hasDigit = RegExp('[0-9]');
|
||||
}
|
||||
|
||||
enum AuthFieldError {
|
||||
emailRequired,
|
||||
emailInvalid,
|
||||
passwordRequired,
|
||||
passwordLength,
|
||||
passwordWeak,
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/data/remote/api_client.dart';
|
||||
import '../../core/data/services/auth_controller.dart';
|
||||
import '../../core/theme/app_colors.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'auth_logic.dart';
|
||||
|
||||
/// 登录 / 注册页:邮箱 + 密码。
|
||||
///
|
||||
/// 风格沿用 `nontonki` 现有页面(深色卡片 + 圆角 + 主色蓝),不另起一套视觉。
|
||||
class AuthPage extends StatefulWidget {
|
||||
const AuthPage({super.key, this.signUpMode = false});
|
||||
|
||||
final bool signUpMode;
|
||||
|
||||
@override
|
||||
State<AuthPage> createState() => _AuthPageState();
|
||||
}
|
||||
|
||||
class _AuthPageState extends State<AuthPage> {
|
||||
late AuthLogic _logic;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_logic = AuthLogic(signUpMode: widget.signUpMode);
|
||||
}
|
||||
|
||||
String _errorText(AppLocalizations l10n, AuthFieldError error) {
|
||||
switch (error) {
|
||||
case AuthFieldError.emailRequired:
|
||||
return l10n.authEmailRequired;
|
||||
case AuthFieldError.emailInvalid:
|
||||
return l10n.authEmailInvalid;
|
||||
case AuthFieldError.passwordRequired:
|
||||
return l10n.authPasswordRequired;
|
||||
case AuthFieldError.passwordLength:
|
||||
return l10n.authPasswordLength;
|
||||
case AuthFieldError.passwordWeak:
|
||||
return l10n.authPasswordWeak;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _submit() async {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final invalid = _logic.validate();
|
||||
if (invalid != null) {
|
||||
setState(() => _logic.errorMessage = _errorText(l10n, invalid));
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_logic.busy = true;
|
||||
_logic.errorMessage = null;
|
||||
});
|
||||
final auth = context.read<AuthController>();
|
||||
try {
|
||||
if (_logic.signUpMode) {
|
||||
await auth.register(
|
||||
email: _logic.normalizedEmail,
|
||||
password: _logic.password,
|
||||
);
|
||||
} else {
|
||||
await auth.signIn(
|
||||
email: _logic.normalizedEmail,
|
||||
password: _logic.password,
|
||||
);
|
||||
}
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).maybePop();
|
||||
} on ApiException catch (error) {
|
||||
// 后端文案已经是可直接展示的中文/印尼语提示,错误码不外露
|
||||
setState(() => _logic.errorMessage = error.message);
|
||||
} catch (_) {
|
||||
setState(() => _logic.errorMessage = l10n.authNetworkError);
|
||||
} finally {
|
||||
if (mounted) setState(() => _logic.busy = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.ink,
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColors.ink,
|
||||
elevation: 0,
|
||||
foregroundColor: Colors.white,
|
||||
title: Text(_logic.signUpMode ? l10n.signUp : l10n.signIn),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
|
||||
children: [
|
||||
Text(
|
||||
_logic.signUpMode ? l10n.authSignUpTitle : l10n.authSignInTitle,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
l10n.authSubtitle,
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 22),
|
||||
_field(
|
||||
label: l10n.authEmailLabel,
|
||||
hint: 'name@example.com',
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
onChanged: (value) => _logic.email = value,
|
||||
autofocus: true,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
_field(
|
||||
label: l10n.authPasswordLabel,
|
||||
hint: l10n.authPasswordHint,
|
||||
obscure: true,
|
||||
onChanged: (value) => _logic.password = value,
|
||||
),
|
||||
if (_logic.errorMessage != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, color: Color(0xFFFF6B6B), size: 16),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
_logic.errorMessage!,
|
||||
style: const TextStyle(color: Color(0xFFFF6B6B), fontSize: 13),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 22),
|
||||
SizedBox(
|
||||
height: 48,
|
||||
child: FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: AppColors.blue,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
),
|
||||
onPressed: _logic.busy ? null : _submit,
|
||||
child: _logic.busy
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
_logic.signUpMode ? l10n.signUp : l10n.signIn,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
TextButton(
|
||||
onPressed: _logic.busy
|
||||
? null
|
||||
: () => setState(() => _logic.toggleMode()),
|
||||
child: Text(
|
||||
_logic.signUpMode ? l10n.authSwitchToSignIn : l10n.authSwitchToSignUp,
|
||||
style: const TextStyle(color: AppColors.blueSoft, fontSize: 13),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _field({
|
||||
required String label,
|
||||
required String hint,
|
||||
required ValueChanged<String> onChanged,
|
||||
bool obscure = false,
|
||||
bool autofocus = false,
|
||||
TextInputType? keyboardType,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: AppColors.muted,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
TextField(
|
||||
autofocus: autofocus,
|
||||
obscureText: obscure,
|
||||
keyboardType: keyboardType,
|
||||
onChanged: onChanged,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 15),
|
||||
decoration: InputDecoration(
|
||||
hintText: hint,
|
||||
hintStyle: const TextStyle(color: Color(0xFF6C7280), fontSize: 14),
|
||||
filled: true,
|
||||
fillColor: AppColors.card,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/data/models/drama.dart';
|
||||
import '../../core/data/services/catalog_controller.dart';
|
||||
import '../discover/discover_logic.dart';
|
||||
import '../drama_detail/drama_detail_view.dart';
|
||||
import '../mine/mine_logic.dart';
|
||||
import '../player/player_view.dart';
|
||||
|
||||
class HomeLogic extends ChangeNotifier {
|
||||
HomeLogic(List<Drama> dramas) : currentDrama = dramas.first;
|
||||
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Drama currentDrama;
|
||||
int tab = 0;
|
||||
int tab = 1;
|
||||
int searchRequest = 0;
|
||||
int sectionRequest = 0;
|
||||
int resumeRequest = 0;
|
||||
@@ -19,6 +22,7 @@ class HomeLogic extends ChangeNotifier {
|
||||
bool drawerOpen = false;
|
||||
bool detailOpen = false;
|
||||
bool videoImmersive = false;
|
||||
bool profile = false;
|
||||
bool _disposed = false;
|
||||
|
||||
void notify() {
|
||||
@@ -62,9 +66,7 @@ class HomeLogic extends ChangeNotifier {
|
||||
if (!context.mounted) return;
|
||||
try {
|
||||
await Navigator.of(context).push<void>(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => DramaDetailPage(drama: currentDrama),
|
||||
),
|
||||
MaterialPageRoute(builder: (_) => DramaDetailPage(drama: currentDrama)),
|
||||
);
|
||||
} finally {
|
||||
if (context.mounted) {
|
||||
@@ -80,6 +82,34 @@ class HomeLogic extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> playDrama(BuildContext context, Drama drama) async {
|
||||
// 列表卡片只有一集预览,进入播放前补齐完整剧集,否则选集列表是空的。
|
||||
var playable = drama;
|
||||
try {
|
||||
playable = await context.read<CatalogController>().requireDetail(drama);
|
||||
} catch (_) {
|
||||
// 取详情失败就用卡片自带的那一集起播。
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => PlayerPage(drama: playable, initialIndex: 0),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void openProfile() {
|
||||
profile = true;
|
||||
scaffoldKey.currentState?.closeDrawer();
|
||||
select(2, mySection: 0);
|
||||
}
|
||||
|
||||
void openLibrary({int section = 1}) {
|
||||
profile = false;
|
||||
scaffoldKey.currentState?.closeDrawer();
|
||||
select(2, mySection: section);
|
||||
}
|
||||
|
||||
void discoverAction(BuildContext context, DiscoverPageAction action) {
|
||||
switch (action) {
|
||||
case DiscoverPageAction.home:
|
||||
@@ -87,7 +117,7 @@ class HomeLogic extends ChangeNotifier {
|
||||
case DiscoverPageAction.my:
|
||||
select(2);
|
||||
case DiscoverPageAction.watchlist:
|
||||
select(2, watchlist: true);
|
||||
openLibrary();
|
||||
case DiscoverPageAction.resume:
|
||||
select(0, resume: true);
|
||||
case DiscoverPageAction.detail:
|
||||
@@ -112,11 +142,10 @@ class HomeLogic extends ChangeNotifier {
|
||||
} else if (videoImmersive) {
|
||||
backRequest++;
|
||||
notify();
|
||||
} else if (tab != 0) {
|
||||
select(0);
|
||||
} else if (tab != 1) {
|
||||
select(1);
|
||||
} else {
|
||||
backRequest++;
|
||||
notify();
|
||||
openMenu();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/config/app_config.dart';
|
||||
import '../../core/data/models/drama.dart';
|
||||
import '../../core/data/services/auth_controller.dart';
|
||||
import '../../core/data/services/catalog_controller.dart';
|
||||
import '../../core/widgets/auth_gate.dart';
|
||||
import '../../core/theme/app_colors.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../discover/discover_view.dart';
|
||||
import '../mine/mine_view.dart';
|
||||
@@ -29,7 +34,6 @@ class HomePage extends StatelessWidget {
|
||||
CatalogController catalog,
|
||||
AppLocalizations l10n,
|
||||
) {
|
||||
|
||||
if (catalog.loading) {
|
||||
return const Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
@@ -46,6 +50,13 @@ class HomePage extends StatelessWidget {
|
||||
Text(catalog.error == null ? l10n.noStories : l10n.catalogError),
|
||||
const SizedBox(height: 12),
|
||||
FilledButton(onPressed: catalog.load, child: Text(l10n.retry)),
|
||||
if (kDebugMode) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
AppConfig.apiBaseUrl,
|
||||
style: const TextStyle(fontSize: 12, color: Colors.white54),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -92,8 +103,11 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _scaffold(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
// 登录态统一从 AuthController 取(原来是 home_logic 里的本地演示开关)
|
||||
final signedIn = context.watch<AuthController>().isSignedIn;
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, _) {
|
||||
@@ -107,8 +121,8 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
drama: logic.currentDrama,
|
||||
onOpenSeries: () => logic.openCurrentSeries(context),
|
||||
onDiscover: () => logic.selectFromMenu(1),
|
||||
onHistory: () => logic.selectFromMenu(2, mySection: 0),
|
||||
onWatchlist: () => logic.selectFromMenu(2, mySection: 1),
|
||||
onHistory: () => logic.openLibrary(section: 0),
|
||||
onWatchlist: logic.openLibrary,
|
||||
onLiked: () => logic.selectFromMenu(2, mySection: 2),
|
||||
),
|
||||
drawerEnableOpenDragGesture: false,
|
||||
@@ -127,7 +141,7 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
resumeRequest: logic.resumeRequest,
|
||||
backRequest: logic.backRequest,
|
||||
onDiscover: () => logic.select(1),
|
||||
onMy: () => logic.select(2),
|
||||
onMy: logic.openProfile,
|
||||
onSearch: () => logic.select(1, search: true),
|
||||
onMenu: logic.openMenu,
|
||||
onImmersiveChanged: logic.onImmersiveChanged,
|
||||
@@ -135,11 +149,15 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
DiscoverPage(
|
||||
drama: logic.currentDrama,
|
||||
dramas: widget.dramas,
|
||||
onDramaSelected: (drama) => logic.openDrama(context, drama),
|
||||
onDramaSelected: (drama) => logic.playDrama(context, drama),
|
||||
duration: Duration.zero,
|
||||
embedded: true,
|
||||
active: logic.tab == 1,
|
||||
searchRequest: logic.searchRequest,
|
||||
signedIn: signedIn,
|
||||
onSignIn: () => openAuthPage(context),
|
||||
onCoins: logic.openProfile,
|
||||
onRewards: logic.openProfile,
|
||||
onAction: (action) => logic.discoverAction(context, action),
|
||||
),
|
||||
MyPage(
|
||||
@@ -148,10 +166,15 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
onDramaSelected: (drama) => logic.openDrama(context, drama),
|
||||
duration: Duration.zero,
|
||||
initialSection: logic.mySection,
|
||||
profile: logic.profile,
|
||||
sectionRequest: logic.sectionRequest,
|
||||
embedded: true,
|
||||
active: logic.tab == 2,
|
||||
onAction: logic.myAction,
|
||||
onOpenHistory: () => logic.openLibrary(section: 0),
|
||||
signedIn: signedIn,
|
||||
onSignIn: () => openAuthPage(context),
|
||||
onSignOut: () => context.read<AuthController>().signOut(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -167,28 +190,38 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
border: Border(top: BorderSide(color: Color(0xFF242329))),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_TabButton(
|
||||
key: const Key('tab-home'),
|
||||
icon: Icons.play_circle_outline_rounded,
|
||||
label: l10n.homeTab,
|
||||
selected: logic.tab == 0,
|
||||
onTap: () => logic.select(0),
|
||||
),
|
||||
_TabButton(
|
||||
key: const Key('tab-discover'),
|
||||
icon: Icons.explore_outlined,
|
||||
label: l10n.discoverTab,
|
||||
icon: Icons.home_outlined,
|
||||
selectedIcon: Icons.home_rounded,
|
||||
label: l10n.homeTab,
|
||||
selected: logic.tab == 1,
|
||||
onTap: () => logic.select(1),
|
||||
),
|
||||
_TabButton(
|
||||
key: const Key('tab-home'),
|
||||
icon: Icons.movie_outlined,
|
||||
selectedIcon: Icons.movie_rounded,
|
||||
label: l10n.shortsTab,
|
||||
selected: logic.tab == 0,
|
||||
onTap: () => logic.select(0),
|
||||
),
|
||||
_TabButton(
|
||||
key: const Key('tab-my-list'),
|
||||
icon: Icons.bookmark_border_rounded,
|
||||
selectedIcon: Icons.bookmark_rounded,
|
||||
label: l10n.myListTab,
|
||||
selected: logic.tab == 2 && !logic.profile,
|
||||
onTap: logic.openLibrary,
|
||||
),
|
||||
_TabButton(
|
||||
key: const Key('tab-my'),
|
||||
icon: Icons.video_library_outlined,
|
||||
icon: Icons.person_outline_rounded,
|
||||
selectedIcon: Icons.person_rounded,
|
||||
label: l10n.myTab,
|
||||
selected: logic.tab == 2,
|
||||
onTap: () => logic.select(2),
|
||||
selected: logic.tab == 2 && logic.profile,
|
||||
onTap: logic.openProfile,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -203,35 +236,47 @@ class _TabButton extends StatelessWidget {
|
||||
const _TabButton({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.selectedIcon,
|
||||
required this.label,
|
||||
required this.selected,
|
||||
required this.onTap,
|
||||
});
|
||||
final IconData icon;
|
||||
final IconData selectedIcon;
|
||||
final String label;
|
||||
final bool selected;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => InkWell(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: 80,
|
||||
Widget build(BuildContext context) => Expanded(
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: 21,
|
||||
color: selected ? const Color(0xFFFF5C37) : const Color(0xFFE6E1DE),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 3),
|
||||
decoration: selected
|
||||
? BoxDecoration(
|
||||
color: AppColors.blue,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
)
|
||||
: null,
|
||||
child: Icon(
|
||||
selected ? selectedIcon : icon,
|
||||
size: 20,
|
||||
color: selected ? Colors.white : AppColors.muted,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: selected
|
||||
? const Color(0xFFFF5C37)
|
||||
: const Color(0xFFE6E1DE),
|
||||
fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
|
||||
color: selected ? AppColors.blue : AppColors.muted,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
+274
-216
@@ -4,7 +4,10 @@ import 'package:provider/provider.dart';
|
||||
import '../../core/formatting/localized_content.dart';
|
||||
import '../../core/data/models/drama.dart';
|
||||
import '../../core/data/repositories/watch_history_repository.dart';
|
||||
import '../../core/data/services/auth_controller.dart';
|
||||
import '../../core/data/services/engagement_controller.dart';
|
||||
import '../../core/widgets/remote_image.dart';
|
||||
import '../../core/theme/app_colors.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'mine_binding.dart';
|
||||
import 'mine_logic.dart';
|
||||
@@ -15,11 +18,16 @@ class MyPage extends StatefulWidget {
|
||||
required this.drama,
|
||||
required this.duration,
|
||||
this.initialSection = 0,
|
||||
this.profile = false,
|
||||
this.onOpenHistory,
|
||||
this.history,
|
||||
this.embedded = false,
|
||||
this.active = true,
|
||||
this.sectionRequest = 0,
|
||||
this.onAction,
|
||||
this.signedIn = false,
|
||||
this.onSignIn,
|
||||
this.onSignOut,
|
||||
this.dramas,
|
||||
this.onDramaSelected,
|
||||
});
|
||||
@@ -27,11 +35,16 @@ class MyPage extends StatefulWidget {
|
||||
final Drama drama;
|
||||
final Duration duration;
|
||||
final int initialSection;
|
||||
final bool profile;
|
||||
final VoidCallback? onOpenHistory;
|
||||
final WatchHistoryRepository? history;
|
||||
final bool embedded;
|
||||
final bool active;
|
||||
final int sectionRequest;
|
||||
final ValueChanged<MyPageAction>? onAction;
|
||||
final bool signedIn;
|
||||
final VoidCallback? onSignIn;
|
||||
final VoidCallback? onSignOut;
|
||||
final List<Drama>? dramas;
|
||||
final ValueChanged<Drama>? onDramaSelected;
|
||||
|
||||
@@ -86,7 +99,7 @@ class _MyPageState extends State<MyPage> {
|
||||
bottom: !widget.embedded,
|
||||
child: Column(
|
||||
children: [
|
||||
_topBar(l10n),
|
||||
if (!widget.profile) _topBar(l10n),
|
||||
Expanded(
|
||||
child: FutureBuilder<Duration?>(
|
||||
future: logic.position,
|
||||
@@ -101,15 +114,13 @@ class _MyPageState extends State<MyPage> {
|
||||
1.0,
|
||||
);
|
||||
return ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 20),
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 20),
|
||||
children: [
|
||||
_profile(l10n),
|
||||
const SizedBox(height: 22),
|
||||
_continueCard(l10n, fraction, position, total),
|
||||
const SizedBox(height: 26),
|
||||
_library(l10n, position, total, fraction),
|
||||
const SizedBox(height: 26),
|
||||
_preferences(l10n),
|
||||
if (widget.profile)
|
||||
..._accountPage(l10n)
|
||||
else ...[
|
||||
_library(l10n, position, total, fraction),
|
||||
],
|
||||
const SizedBox(height: 24),
|
||||
Center(
|
||||
child: Text(
|
||||
@@ -147,8 +158,8 @@ class _MyPageState extends State<MyPage> {
|
||||
const Icon(Icons.play_circle_fill_rounded, color: _orange, size: 27),
|
||||
const SizedBox(width: 7),
|
||||
Text(
|
||||
l10n.myTab,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w800),
|
||||
l10n.myListTab,
|
||||
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.w800),
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
@@ -172,158 +183,247 @@ class _MyPageState extends State<MyPage> {
|
||||
),
|
||||
);
|
||||
|
||||
Widget _profile(AppLocalizations l10n) => Row(
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundColor: Color(0xFF32343A),
|
||||
child: Icon(Icons.person_rounded, color: Colors.white, size: 34),
|
||||
List<Widget> _accountPage(AppLocalizations l10n) => [
|
||||
if (widget.signedIn) _signedInRow(l10n) else _guestRow(l10n),
|
||||
if (widget.signedIn) ...[const SizedBox(height: 18), _wallet(l10n)],
|
||||
const SizedBox(height: 14),
|
||||
_menuCard(l10n),
|
||||
const SizedBox(height: 18),
|
||||
Text(
|
||||
l10n.preferencesHeading,
|
||||
style: const TextStyle(
|
||||
color: AppColors.muted,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w800,
|
||||
letterSpacing: 1.1,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.localViewer,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 19, fontWeight: FontWeight.w800),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
l10n.localDemoProfile,
|
||||
style: const TextStyle(color: Color(0xFFE6E1E3), fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 11, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF24252A),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(l10n.demo, style: const TextStyle(fontSize: 11)),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Widget _continueCard(
|
||||
AppLocalizations l10n,
|
||||
double fraction,
|
||||
Duration position,
|
||||
Duration total,
|
||||
) => Container(
|
||||
padding: const EdgeInsets.all(13),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF201B1E),
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
const SizedBox(height: 8),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(Icons.language_rounded, color: AppColors.blueSoft),
|
||||
title: Text(l10n.appLanguage),
|
||||
trailing: const Icon(Icons.chevron_right_rounded),
|
||||
onTap: () => logic.showLanguage(context),
|
||||
),
|
||||
];
|
||||
|
||||
Widget _guestRow(AppLocalizations l10n) {
|
||||
return Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.history_rounded, color: _orange, size: 17),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
l10n.continueWatching,
|
||||
const CircleAvatar(
|
||||
radius: 28,
|
||||
backgroundColor: Color(0xFF32343A),
|
||||
child: Icon(Icons.person_rounded, color: Colors.white, size: 30),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
l10n.logInHint,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
TextButton(
|
||||
onPressed: widget.onSignIn,
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: AppColors.blue,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
shape: const StadiumBorder(),
|
||||
),
|
||||
child: Text(l10n.logIn),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _signedInRow(AppLocalizations l10n) {
|
||||
// 显示真实登录账号(昵称 + uid);拿不到才回落到演示文案
|
||||
final user = context.watch<AuthController>().user;
|
||||
final name = (user?.nickname.isNotEmpty ?? false) ? user!.nickname : l10n.mockUserName;
|
||||
final uidText = (user?.uid.isNotEmpty ?? false) ? 'ID: ${user!.uid}' : l10n.mockUserId;
|
||||
return Row(
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
radius: 28,
|
||||
backgroundColor: Color(0xFF32343A),
|
||||
child: Icon(Icons.person_rounded, color: Colors.white, size: 30),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
l10n.episodeProgress(1, widget.drama.episodes.length),
|
||||
style: const TextStyle(color: Color(0xFFFFA38F), fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
_poster(width: 75, height: 96),
|
||||
const SizedBox(width: 11),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
localizedDramaTitle(l10n, widget.drama),
|
||||
style: const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
l10n.dramaTag,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFE6E1E3),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
l10n.watchedPercent((fraction * 100).round()),
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFE7DEDD),
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
child: LinearProgressIndicator(
|
||||
value: fraction,
|
||||
minHeight: 4,
|
||||
backgroundColor: const Color(0xFF444046),
|
||||
color: _orange,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
'${_clock(position)} / ${_clock(total)}',
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFE6E1E3),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
uidText,
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.icon(
|
||||
onPressed: () => logic.act(
|
||||
context,
|
||||
MyPageAction.resume,
|
||||
embedded: widget.embedded,
|
||||
onAction: widget.onAction,
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: _orange,
|
||||
foregroundColor: Colors.white,
|
||||
minimumSize: const Size.fromHeight(37),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
),
|
||||
),
|
||||
icon: const Icon(Icons.play_arrow_rounded, size: 18),
|
||||
label: Text(l10n.resume),
|
||||
],
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: widget.onSignOut ?? () => _mockSnack(l10n),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2A2C33),
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
shape: const StadiumBorder(),
|
||||
),
|
||||
child: Text(l10n.signOut),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Widget _wallet(AppLocalizations l10n) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF17191F),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.myAccount,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w800),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _accountTile(
|
||||
label: l10n.coins,
|
||||
value: '\$ 0',
|
||||
action: l10n.topUpWallet,
|
||||
color: AppColors.blue,
|
||||
onPressed: () => _mockSnack(l10n),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: _accountTile(
|
||||
label: l10n.vipMembership,
|
||||
value: l10n.notActive,
|
||||
action: l10n.joinVip,
|
||||
color: const Color(0xFFF5C451),
|
||||
onPressed: () => _mockSnack(l10n),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _mockSnack(AppLocalizations l10n) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(l10n.mockNotice)));
|
||||
}
|
||||
|
||||
Widget _accountTile({
|
||||
required String label,
|
||||
required String value,
|
||||
required String action,
|
||||
required Color color,
|
||||
required VoidCallback onPressed,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF12141A),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: color.withValues(alpha: 0.45)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: TextStyle(color: color, fontSize: 12)),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w800),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton(
|
||||
onPressed: onPressed,
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: color,
|
||||
foregroundColor: color == AppColors.blue
|
||||
? Colors.white
|
||||
: const Color(0xFF2A2110),
|
||||
visualDensity: VisualDensity.compact,
|
||||
shape: const StadiumBorder(),
|
||||
),
|
||||
child: Text(action, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _menuCard(AppLocalizations l10n) {
|
||||
return Material(
|
||||
color: const Color(0xFF17191F),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.card_giftcard_rounded,
|
||||
color: AppColors.blueSoft,
|
||||
),
|
||||
title: Text(l10n.earnRewards),
|
||||
trailing: Text(
|
||||
l10n.freeBonus,
|
||||
style: const TextStyle(color: AppColors.blue, fontSize: 12),
|
||||
),
|
||||
onTap: () => _mockSnack(l10n),
|
||||
),
|
||||
const Divider(height: 1, color: Color(0xFF2A2C33)),
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.history_rounded,
|
||||
color: AppColors.blueSoft,
|
||||
),
|
||||
title: Text(l10n.watchHistory),
|
||||
trailing: const Icon(Icons.chevron_right_rounded),
|
||||
onTap: widget.onOpenHistory,
|
||||
),
|
||||
const Divider(height: 1, color: Color(0xFF2A2C33)),
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.settings_rounded,
|
||||
color: AppColors.blueSoft,
|
||||
),
|
||||
title: Text(l10n.settings),
|
||||
trailing: const Icon(Icons.chevron_right_rounded),
|
||||
onTap: () => logic.showLanguage(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _library(
|
||||
AppLocalizations l10n,
|
||||
@@ -353,14 +453,25 @@ class _MyPageState extends State<MyPage> {
|
||||
for (var index = 0; index < tabs.length; index++) ...[
|
||||
InkWell(
|
||||
onTap: () => logic.selectSection(index),
|
||||
child: Text(
|
||||
tabs[index],
|
||||
style: TextStyle(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 14,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: logic.section == index
|
||||
? _orange
|
||||
: const Color(0xFFE4DBDD),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w800,
|
||||
? AppColors.blue
|
||||
: const Color(0xFF24262E),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
tabs[index],
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -446,7 +557,7 @@ class _MyPageState extends State<MyPage> {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFFA18D),
|
||||
color: AppColors.blueSoft,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
@@ -507,12 +618,7 @@ class _MyPageState extends State<MyPage> {
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Image.asset(
|
||||
drama.posterAsset,
|
||||
width: 74,
|
||||
height: 103,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
child: RemoteImage(drama.posterUrl, width: 74, height: 103),
|
||||
),
|
||||
const SizedBox(width: 11),
|
||||
Expanded(
|
||||
@@ -530,7 +636,7 @@ class _MyPageState extends State<MyPage> {
|
||||
),
|
||||
const SizedBox(height: 7),
|
||||
Text(
|
||||
l10n.episodeCount(drama.episodes.length),
|
||||
l10n.episodeCount(drama.episodeCount),
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFE6E1E3),
|
||||
fontSize: 12,
|
||||
@@ -545,49 +651,6 @@ class _MyPageState extends State<MyPage> {
|
||||
),
|
||||
);
|
||||
|
||||
Widget _preferences(AppLocalizations l10n) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.preferencesHeading,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFCEBBB9),
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w800,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Material(
|
||||
color: const Color(0xFF1B1C21),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ListTile(
|
||||
leading: const Icon(
|
||||
Icons.translate_rounded,
|
||||
color: Color(0xFFFFBC65),
|
||||
),
|
||||
title: Text(l10n.appLanguage),
|
||||
subtitle: Text(l10n.language),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
Localizations.localeOf(context).languageCode == 'zh'
|
||||
? l10n.simplifiedChinese
|
||||
: l10n.english,
|
||||
style: const TextStyle(color: Color(0xFFFFB2A1), fontSize: 11),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.chevron_right_rounded, size: 18),
|
||||
],
|
||||
),
|
||||
onTap: () => logic.showLanguage(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Widget _bottomNav(AppLocalizations l10n) => Container(
|
||||
height: 63,
|
||||
decoration: const BoxDecoration(
|
||||
@@ -629,12 +692,7 @@ class _MyPageState extends State<MyPage> {
|
||||
|
||||
Widget _poster({required double width, required double height}) => ClipRRect(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
child: Image.asset(
|
||||
widget.drama.posterAsset,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
child: RemoteImage(widget.drama.posterUrl, width: width, height: height),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -683,4 +741,4 @@ String _clock(Duration duration) {
|
||||
return '${(seconds ~/ 60).toString().padLeft(2, '0')}:${(seconds % 60).toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
const _orange = Color(0xFFFF5B3D);
|
||||
const _orange = AppColors.blue;
|
||||
+296
-570
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user