mod: 修改bottomBar样式

This commit is contained in:
guozhigq
2023-06-30 00:03:42 +08:00
parent b43b9549b9
commit 2fa3dfa53f
4 changed files with 21 additions and 62 deletions

View File

@ -19,82 +19,32 @@ class MainController extends GetxController {
];
RxList navigationBars = [
{
// 'icon': const Icon(Icons.home_outlined),
// 'selectedIcon': const Icon(Icons.home),
'icon': const Icon(
CupertinoIcons.square_favorites_alt,
size: 21,
),
'selectedIcon': const Icon(
CupertinoIcons.square_favorites_alt_fill,
Icons.motion_photos_on_outlined,
size: 21,
),
'label': "推荐",
},
{
// 'icon': const Icon(Icons.whatshot_outlined),
// 'selectedIcon': const Icon(Icons.whatshot_rounded),
'icon': const Icon(
CupertinoIcons.flame,
size: 20,
),
'selectedIcon': const Icon(
CupertinoIcons.flame_fill,
Icons.eco,
size: 20,
),
'label': "热门",
},
{
'icon': const Icon(
CupertinoIcons.camera_on_rectangle,
size: 21,
),
'selectedIcon': const Icon(
CupertinoIcons.camera_on_rectangle_fill,
Icons.bolt,
size: 21,
),
'label': "动态",
},
{
// 'icon': const Icon(Icons.person_outline),
// 'selectedIcon': const Icon(Icons.person),
'icon': const Icon(
CupertinoIcons.folder,
size: 20,
),
'selectedIcon': const Icon(
CupertinoIcons.folder_fill,
Icons.folder_open_outlined,
size: 20,
),
'label': "媒体库",
}
].obs;
@override
void onInit() {
super.onInit();
// readuUserFace();
}
// 设置头像
// readuUserFace() async {
// Box user = GStrorage.user;
// if (user.get(UserBoxKey.userFace) != null) {
// navigationBars.last['icon'] =
// navigationBars.last['selectedIcon'] = NetworkImgLayer(
// width: 25,
// height: 25,
// type: 'avatar',
// src: user.get(UserBoxKey.userFace),
// );
// navigationBars.last['label'] = '我';
// }
// }
// 重置
// resetLast() {
// navigationBars.last['icon'] = const Icon(Icons.person_outline);
// navigationBars.last['selectedIcon'] = const Icon(Icons.person);
// navigationBars.last['label'] = '我的';
// }
}

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/pages/home/index.dart';
import 'package:pilipala/pages/hot/index.dart';
import 'package:salomon_bottom_bar/salomon_bottom_bar.dart';
import './controller.dart';
class MainApp extends StatefulWidget {
@ -111,17 +112,16 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
),
),
),
bottomNavigationBar: NavigationBar(
elevation: 1,
destinations: _mainController.navigationBars.map((e) {
return NavigationDestination(
bottomNavigationBar: SalomonBottomBar(
currentIndex: selectedIndex,
onTap: (value) => setIndex(value),
items: _mainController.navigationBars.map((e) {
return SalomonBottomBarItem(
icon: e['icon'],
selectedIcon: e['selectedIcon'],
label: e['label'],
title: Text(e['label']),
selectedColor: Theme.of(context).colorScheme.primary,
);
}).toList(),
selectedIndex: selectedIndex,
onDestinationSelected: (value) => setIndex(value),
),
);
}

View File

@ -902,6 +902,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.2"
salomon_bottom_bar:
dependency: "direct main"
description:
name: salomon_bottom_bar
sha256: e20abf2e449749432223a8b4e6647c212eef6c2b638e0ed8cc92eff9529c2b48
url: "https://pub.dev"
source: hosted
version: "3.3.2"
screen_brightness:
dependency: transitive
description:

View File

@ -79,6 +79,7 @@ dependencies:
url: https://github.com/guozhigq/flutter_meedu_media_kit.git
ref: feature-custom
path: package
salomon_bottom_bar: ^3.3.2
dev_dependencies:
flutter_test: