logo和名称替换
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/hj_page/main_page/provider/bottom_bar_provider.dart';
|
||||
import 'package:hgmj/hj_page/pre_sale/pre_sale_provider.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/hj_page/main_page/provider/bottom_bar_provider.dart';
|
||||
import 'package:wydj/hj_page/pre_sale/pre_sale_provider.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:wydj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/config.dart';
|
||||
@@ -50,13 +50,17 @@ class MainPageTabbar extends StatelessWidget {
|
||||
padding: EdgeInsets.fromLTRB(12, 0, 12, screen.paddingBottom),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
border: Border(top: BorderSide(color: Colors.black.withValues(alpha: 0.02))),
|
||||
border: Border(
|
||||
top: BorderSide(color: Colors.black.withValues(alpha: 0.02))),
|
||||
),
|
||||
child: Row(
|
||||
children: List.generate(logic.tabs.length, (index) {
|
||||
if (index == 0) return _scrollTopItem<HomeBottomProvider>(index, cur);
|
||||
if (Config.darkWebEnable && index == 2) return _scrollTopItem<DarkwebBottomProvider>(index, cur);
|
||||
if (index == logic.communityTab) return _scrollTopItem<CommunityBottomProvider>(index, cur);
|
||||
if (index == 0)
|
||||
return _scrollTopItem<HomeBottomProvider>(index, cur);
|
||||
if (Config.darkWebEnable && index == 2)
|
||||
return _scrollTopItem<DarkwebBottomProvider>(index, cur);
|
||||
if (index == logic.communityTab)
|
||||
return _scrollTopItem<CommunityBottomProvider>(index, cur);
|
||||
return _normalItem(index, cur);
|
||||
}),
|
||||
),
|
||||
@@ -69,9 +73,13 @@ class MainPageTabbar extends StatelessWidget {
|
||||
final isSelected = index == cur;
|
||||
return Consumer<T>(builder: (_, provider, __) {
|
||||
final isTop = provider.showTop && isSelected;
|
||||
final imagePath = isTop ? 'jump_to_top.png'.homePath : _iconPath(index, isSelected);
|
||||
final imagePath =
|
||||
isTop ? 'jump_to_top.png'.homePath : _iconPath(index, isSelected);
|
||||
//暗网配置Icon
|
||||
final isDarkConfigImg = index == 2 && isSelected && Config.darkWebEnable && Config.darkWebIcon?.isNotEmpty == true;
|
||||
final isDarkConfigImg = index == 2 &&
|
||||
isSelected &&
|
||||
Config.darkWebEnable &&
|
||||
Config.darkWebIcon?.isNotEmpty == true;
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
enableFeedback: false,
|
||||
@@ -80,7 +88,9 @@ class MainPageTabbar extends StatelessWidget {
|
||||
isSelected: isSelected,
|
||||
text: isTop ? '顶部' : logic.tabs[index].title,
|
||||
icon: isDarkConfigImg
|
||||
? NetworkImageLoader(key: const ValueKey('darkIcon'), imageUrl: Config.darkWebIcon)
|
||||
? NetworkImageLoader(
|
||||
key: const ValueKey('darkIcon'),
|
||||
imageUrl: Config.darkWebIcon)
|
||||
: Image.asset(imagePath, key: ValueKey(imagePath), width: 24),
|
||||
),
|
||||
),
|
||||
@@ -105,10 +115,12 @@ class MainPageTabbar extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
String _iconPath(int index, bool isSelected) => isSelected ? logic.tabs[index].imageSel : logic.tabs[index].imageNor;
|
||||
String _iconPath(int index, bool isSelected) =>
|
||||
isSelected ? logic.tabs[index].imageSel : logic.tabs[index].imageNor;
|
||||
|
||||
/// 图标 + 文案:图标切换(key 变即图片路径变)交叉淡入,文字颜色平滑过渡
|
||||
Widget _tabContent({required Widget icon, required bool isSelected, required String text}) {
|
||||
Widget _tabContent(
|
||||
{required Widget icon, required bool isSelected, required String text}) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
@@ -117,13 +129,16 @@ class MainPageTabbar extends StatelessWidget {
|
||||
Container(
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
child: AnimatedSwitcher(duration: const Duration(milliseconds: 180), child: icon),
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 180), child: icon),
|
||||
),
|
||||
2.sizeBoxH,
|
||||
AnimatedDefaultTextStyle(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
style: TextStyle(
|
||||
color: isSelected ? const Color(0xffFFC000) : const Color(0x59FFFFFF),
|
||||
color: isSelected
|
||||
? const Color(0xffFFC000)
|
||||
: const Color(0x59FFFFFF),
|
||||
fontSize: 10,
|
||||
),
|
||||
child: Text(text),
|
||||
|
||||
Reference in New Issue
Block a user