File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed
Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class MyHomePage extends StatelessWidget {
105105 label: S .current.appName,
106106 ),
107107 NavigationDestination (
108- icon: const Icon ( Icons .arrow_downward ),
108+ icon: _buildDownloadIcon ( ),
109109 label: '下载管理' ,
110110 ),
111111 NavigationDestination (
@@ -124,6 +124,46 @@ class MyHomePage extends StatelessWidget {
124124 controller.setPageIndex (index);
125125 })));
126126 }
127+
128+ Widget _buildDownloadIcon () {
129+ return Obx (() {
130+ int activeCount = DownloadManager .activeTasks.length;
131+
132+ // 基础图标 - 使用可用的图标
133+ Widget baseIcon = const Icon (Icons .get_app); // 尝试 get_app 图标
134+
135+ if (activeCount > 0 ) {
136+ // 有活跃下载时,显示简单的文字徽章
137+ return Stack (
138+ clipBehavior: Clip .none,
139+ children: [
140+ baseIcon,
141+ Positioned (
142+ right: - 8 ,
143+ top: - 8 ,
144+ child: Container (
145+ padding: const EdgeInsets .all (4 ),
146+ decoration: const BoxDecoration (
147+ color: Colors .red,
148+ shape: BoxShape .circle,
149+ ),
150+ child: Text (
151+ '$activeCount ' ,
152+ style: const TextStyle (
153+ color: Colors .white,
154+ fontSize: 10 ,
155+ fontWeight: FontWeight .bold,
156+ ),
157+ ),
158+ ),
159+ ),
160+ ],
161+ );
162+ } else {
163+ return baseIcon;
164+ }
165+ });
166+ }
127167}
128168
129169class _MainController extends GetxController {
You can’t perform that action at this time.
0 commit comments