| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461 |
- import 'package:flutter/material.dart';
- import '../../../core/l10n/app_localizations.dart';
- import '../../../core/theme/app_colors.dart';
- class AppHomeScreen extends StatelessWidget {
- const AppHomeScreen({super.key});
- static const _projects = <_HotProject>[
- _HotProject(
- id: 'runes',
- icoImg: 'ico_runes.png',
- shortName: 'M',
- background: LinearGradient(
- colors: [Color(0xFF9F7AEA), Color(0xFF5A3FE0)],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- ),
- ),
- _HotProject(
- id: 'tesla',
- icoImg: 'ico_tesla.png',
- shortName: 'S',
- background: LinearGradient(
- colors: [Color(0xFFDEE9FF), Color(0xFF7B89A8)],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- textColor: Color(0xFF1E2329),
- ),
- _HotProject(
- id: 'floki',
- icoImg: 'ico_floki.png',
- shortName: 'F',
- background: LinearGradient(
- colors: [Color(0xFF1E1E1E), Color(0xFFFFA726)],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- _HotProject(
- id: 'vcAlliance',
- icoImg: 'ico_ftlm.png',
- shortName: 'VC',
- background: LinearGradient(
- colors: [Color(0xFF2490FF), Color(0xFF1D5FE6)],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- ),
- ),
- _HotProject(
- id: 'aur',
- icoImg: 'ico_aur.png',
- shortName: 'A',
- background: LinearGradient(
- colors: [Color(0xFF101E45), Color(0xFF13B9FF)],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- _HotProject(
- id: 'vtf',
- icoImg: 'ico_vtf.png',
- shortName: 'VTF',
- background: LinearGradient(
- colors: [Color(0xFF03112E), Color(0xFF1F78FF)],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- ),
- ),
- _HotProject(
- id: 'footballCoin',
- icoImg: 'ico_zqb.png',
- shortName: 'FC',
- background: LinearGradient(
- colors: [Color(0xFFF6E7C9), Color(0xFFB5D98A)],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- textColor: Color(0xFF1E2329),
- ),
- _HotProject(
- id: 'jarvis',
- icoImg: 'ico_jws.png',
- shortName: 'AI',
- background: LinearGradient(
- colors: [Color(0xFFD9FFD8), Color(0xFF9BE7C2)],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- ),
- textColor: Color(0xFF114C3A),
- ),
- ];
- void _handleProjectTap(BuildContext context) {
- _showDevelopingDialog(context);
- }
- static void _showDevelopingDialog(BuildContext context) {
- final l10n = AppLocalizations.of(context)!;
- final isDark = Theme.of(context).brightness == Brightness.dark;
- final dialogBg = isDark ? AppColors.darkBgSecondary : Colors.white;
- final titleColor = isDark ? AppColors.darkTextPrimary : Colors.black;
- final messageColor = isDark
- ? AppColors.darkTextSecondary
- : const Color(0xFF666666);
- final buttonBg = isDark ? AppColors.brand : Colors.black;
- final buttonFg = isDark ? Colors.black : Colors.white;
- showDialog<void>(
- context: context,
- barrierDismissible: true,
- builder: (dialogContext) => Dialog(
- backgroundColor: dialogBg,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
- insetPadding: const EdgeInsets.symmetric(horizontal: 48, vertical: 48),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 28),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- l10n.appHomeComingSoon,
- style: TextStyle(
- color: titleColor,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- ),
- const SizedBox(height: 8),
- Text(
- l10n.appHomeDevelopingMessage,
- style: TextStyle(
- color: messageColor,
- fontSize: 13,
- ),
- ),
- const SizedBox(height: 20),
- SizedBox(
- width: double.infinity,
- child: TextButton(
- onPressed: () => Navigator.of(dialogContext).pop(),
- style: TextButton.styleFrom(
- backgroundColor: buttonBg,
- foregroundColor: buttonFg,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(8),
- ),
- padding: const EdgeInsets.symmetric(vertical: 12),
- ),
- child: Text(l10n.confirmLabel),
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- @override
- Widget build(BuildContext context) {
- final l10n = AppLocalizations.of(context)!;
- final isDark = Theme.of(context).brightness == Brightness.dark;
- final backgroundColor = isDark ? AppColors.darkBg : Colors.white;
- final titleColor = isDark ? AppColors.darkTextPrimary : Colors.black;
- final sectionTitleColor = isDark ? AppColors.darkTextPrimary : Colors.black;
- return Scaffold(
- backgroundColor: backgroundColor,
- appBar: AppBar(
- backgroundColor: backgroundColor,
- elevation: 0,
- scrolledUnderElevation: 0,
- centerTitle: true,
- title: Text(
- l10n.appHomeTitle,
- style: TextStyle(
- color: titleColor,
- fontSize: 18,
- fontWeight: FontWeight.w600,
- ),
- ),
- leading: IconButton(
- icon: Icon(Icons.arrow_back_ios_new, color: titleColor),
- onPressed: () => Navigator.of(context).maybePop(),
- ),
- ),
- body: SafeArea(
- top: false,
- child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(10, 8, 10, 24),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const _HeroBanner(),
- const SizedBox(height: 28),
- Text(
- l10n.appHomeHotProjects,
- style: TextStyle(
- color: sectionTitleColor,
- fontSize: 18,
- fontWeight: FontWeight.bold,
- ),
- ),
- const SizedBox(height: 18),
- LayoutBuilder(
- builder: (context, constraints) {
- const crossAxisCount = 5;
- const spacing = 14.0;
- final tileWidth =
- (constraints.maxWidth - spacing * (crossAxisCount - 1)) /
- crossAxisCount;
- return Wrap(
- spacing: spacing,
- runSpacing: 22,
- children: _projects
- .map(
- (project) => SizedBox(
- width: tileWidth,
- child: _ProjectTile(
- label: _projectLabel(l10n, project.id),
- project: project,
- isDark: isDark,
- onTap: () => _handleProjectTap(context),
- ),
- ),
- )
- .toList(),
- );
- },
- ),
- ],
- ),
- ),
- ),
- );
- }
- String _projectLabel(AppLocalizations l10n, String id) {
- switch (id) {
- case 'runes':
- return l10n.appHomeProjectRunes;
- case 'tesla':
- return l10n.appHomeProjectTesla;
- case 'floki':
- return l10n.appHomeProjectFloki;
- case 'vcAlliance':
- return l10n.appHomeProjectVcAlliance;
- case 'aur':
- return l10n.appHomeProjectAur;
- case 'vtf':
- return l10n.appHomeProjectVtf;
- case 'footballCoin':
- return l10n.appHomeProjectFootballCoin;
- case 'jarvis':
- return l10n.appHomeProjectJarvis;
- default:
- return id;
- }
- }
- }
- class _HeroBanner extends StatelessWidget {
- const _HeroBanner();
- @override
- Widget build(BuildContext context) {
- final l10n = AppLocalizations.of(context)!;
- return Container(
- width: double.infinity,
- height: 200,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(20),
- gradient: const LinearGradient(
- colors: [Color(0xFF020202), Color(0xFF171103), Color(0xFF9A6800)],
- begin: Alignment.centerLeft,
- end: Alignment.centerRight,
- ),
- boxShadow: const [
- BoxShadow(
- color: Color(0x33000000),
- blurRadius: 24,
- offset: Offset(0, 10),
- ),
- ],
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(8),
- child: Stack(
- children: [
- Positioned(
- right: -10,
- top: -20,
- bottom: -10,
- child: Opacity(
- opacity: 0.9,
- child: Image.asset(
- 'assets/images/top_bg_app_home.png',
- fit: BoxFit.cover,
- ),
- ),
- ),
- Positioned(
- right: 0,
- top: 0,
- bottom: 0,
- width: 180,
- child: DecoratedBox(
- decoration: BoxDecoration(
- gradient: RadialGradient(
- colors: [
- AppColors.brand.withValues(alpha: 0.45),
- Colors.transparent,
- ],
- radius: 0.95,
- center: const Alignment(0.6, -0.2),
- ),
- ),
- ),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(18, 18, 18, 18),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- //钱包图标
- Image.asset("assets/images/ico_iBit_wallet.png",width:30,),
- const Spacer(),
- Text(
- l10n.appHomeHeroTitle,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 19,
- fontWeight: FontWeight.w700,
- ),
- ),
- const SizedBox(height: 6),
- RichText(
- text: TextSpan(
- style: const TextStyle(
- color: Colors.white,
- fontSize: 19,
- fontWeight: FontWeight.w700,
- ),
- children: [
- TextSpan(
- text: l10n.appHomeAnnualizedYieldPrefix,
- ),
- TextSpan(
- text: '666%',
- style: const TextStyle(
- color: Color(0xFFF2B713),
- fontSize: 22,
- fontWeight: FontWeight.w700,
- ),
- ),
- TextSpan(
- text: l10n.appHomeAnnualizedYieldSuffix,
- ),
- ],
- ),
- ),
- const SizedBox(height: 16),
- Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 18,
- vertical: 5,
- ),
- decoration: BoxDecoration(
- border: Border.all(color: AppColors.brand, width: 1.2),
- borderRadius: BorderRadius.circular(22),
- ),
- child: Text(
- l10n.appHomeExclusiveBadge,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 13,
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
- class _ProjectTile extends StatelessWidget {
- const _ProjectTile({
- required this.label,
- required this.project,
- required this.onTap,
- required this.isDark,
- });
- final String label;
- final _HotProject project;
- final VoidCallback onTap;
- final bool isDark;
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: onTap,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(
- width: 50,
- height: 50,
- child: ClipRRect(
- borderRadius: BorderRadius.circular(8),
- child: Image.asset(
- 'assets/images/${project.icoImg}',
- fit: BoxFit.cover,
- ),
- ),
- ),
- const SizedBox(height: 10),
- Text(
- label,
- textAlign: TextAlign.center,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: isDark
- ? AppColors.darkTextPrimary
- : AppColors.lightTextSecondary,
- fontSize: 13,
- fontWeight: FontWeight.w500,
- height: 1.2,
- ),
- ),
- ],
- ),
- );
- }
- }
- class _HotProject {
- const _HotProject({
- required this.id,
- required this.icoImg,
- required this.shortName,
- required this.background,
- this.textColor = Colors.white,
- });
- final String id;
- final String icoImg;
- final String shortName;
- final Gradient background;
- final Color textColor;
- }
|