當您使用 vscode 并將Icon(Icons."the icon")呼叫到您的代碼時,該圖示始終顯示在右側的代碼行號部分(我不關心 Android Studio)。我呼叫的比例圖示沒有出現在側面,然后當我將游標懸停時,比例影像被破壞。我如何解決它?


這是代碼
import 'package:flutter/material.dart';
import 'package:project_ukk/constants/color_constant.dart';
import 'package:bubble_bottom_bar/bubble_bottom_bar.dart';
import 'package:project_ukk/pages/user_page/collection/collection_page.dart';
import 'package:project_ukk/pages/user_page/home/home_page.dart';
import 'package:project_ukk/pages/user_page/profile/profile_page.dart';
import 'package:project_ukk/pages/user_page/search/auction_page.dart';
class PageNavBar extends StatefulWidget {
const PageNavBar({Key? key}) : super(key: key);
@override
State<PageNavBar> createState() => _PageNavBarState();
}
class _PageNavBarState extends State<PageNavBar> {
int currentIndex = 0;
void changePage(int? index) {
setState(() {
currentIndex = index!;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: () {
print('button pressed');
},
child: const Icon(
Icons.add,
size: 35,
),
backgroundColor: kRedColor,
),
floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
body: <Widget>[
HomePage(0),
AuctionPage(1),
CollectionPage(2),
ProfilePage(3),
][currentIndex],
bottomNavigationBar: BubbleBottomBar(
hasNotch: true,
fabLocation: BubbleBottomBarFabLocation.end,
opacity: 0.2,
currentIndex: currentIndex,
onTap: changePage,
borderRadius: const BorderRadius.vertical(
top: Radius.circular(16),
),
elevation: 8,
tilesPadding: const EdgeInsets.symmetric(vertical: 8.0),
items: const <BubbleBottomBarItem>[
BubbleBottomBarItem(
backgroundColor: kDarkBlue,
icon: Icon(
Icons.dashboard_outlined,
color: kBlackColor,
),
activeIcon: Icon(
Icons.dashboard_rounded,
color: kModerateCyan,
),
title: Text('Home'),
),
BubbleBottomBarItem(
backgroundColor: kDarkBlue,
icon: Icon(
Icons.scale_outlined,
color: kBlackColor,
),
activeIcon: Icon(
Icons.scale,
color: kPowderBlue,
),
title: Text('Logs'),
),
BubbleBottomBarItem(
backgroundColor: kDarkBlue,
icon: Icon(
Icons.collections_outlined,
color: kBlackColor,
),
activeIcon: Icon(
Icons.collections,
color: kLightRedColor,
),
title: Text('Logs'),
),
BubbleBottomBarItem(
backgroundColor: kDarkBlue,
icon: Icon(
Icons.person_outline,
color: kBlackColor,
),
activeIcon: Icon(
Icons.person,
color: kLightOrange,
),
title: Text('Logs'),
)
],
),
);
}
}
uj5u.com熱心網友回復:
這個問題與 Flutter 或 Dart 沒有任何關系——這是您正在使用的 IDE 問題(似乎您正在使用 Visual Studio Code)。
事實上,這是一個已知問題,在此處的 Flutter 背景關系中和global here中都提到過。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/427173.html
