mod: 修改bottomBar样式
This commit is contained in:
@ -19,82 +19,32 @@ class MainController extends GetxController {
|
|||||||
];
|
];
|
||||||
RxList navigationBars = [
|
RxList navigationBars = [
|
||||||
{
|
{
|
||||||
// 'icon': const Icon(Icons.home_outlined),
|
|
||||||
// 'selectedIcon': const Icon(Icons.home),
|
|
||||||
'icon': const Icon(
|
'icon': const Icon(
|
||||||
CupertinoIcons.square_favorites_alt,
|
Icons.motion_photos_on_outlined,
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
'selectedIcon': const Icon(
|
|
||||||
CupertinoIcons.square_favorites_alt_fill,
|
|
||||||
size: 21,
|
size: 21,
|
||||||
),
|
),
|
||||||
'label': "推荐",
|
'label': "推荐",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// 'icon': const Icon(Icons.whatshot_outlined),
|
|
||||||
// 'selectedIcon': const Icon(Icons.whatshot_rounded),
|
|
||||||
'icon': const Icon(
|
'icon': const Icon(
|
||||||
CupertinoIcons.flame,
|
Icons.eco,
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
'selectedIcon': const Icon(
|
|
||||||
CupertinoIcons.flame_fill,
|
|
||||||
size: 20,
|
size: 20,
|
||||||
),
|
),
|
||||||
'label': "热门",
|
'label': "热门",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
'icon': const Icon(
|
||||||
CupertinoIcons.camera_on_rectangle,
|
Icons.bolt,
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
'selectedIcon': const Icon(
|
|
||||||
CupertinoIcons.camera_on_rectangle_fill,
|
|
||||||
size: 21,
|
size: 21,
|
||||||
),
|
),
|
||||||
'label': "动态",
|
'label': "动态",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// 'icon': const Icon(Icons.person_outline),
|
|
||||||
// 'selectedIcon': const Icon(Icons.person),
|
|
||||||
'icon': const Icon(
|
'icon': const Icon(
|
||||||
CupertinoIcons.folder,
|
Icons.folder_open_outlined,
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
'selectedIcon': const Icon(
|
|
||||||
CupertinoIcons.folder_fill,
|
|
||||||
size: 20,
|
size: 20,
|
||||||
),
|
),
|
||||||
'label': "媒体库",
|
'label': "媒体库",
|
||||||
}
|
}
|
||||||
].obs;
|
].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'] = '我的';
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/pages/home/index.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/hot/index.dart';
|
import 'package:pilipala/pages/hot/index.dart';
|
||||||
|
import 'package:salomon_bottom_bar/salomon_bottom_bar.dart';
|
||||||
import './controller.dart';
|
import './controller.dart';
|
||||||
|
|
||||||
class MainApp extends StatefulWidget {
|
class MainApp extends StatefulWidget {
|
||||||
@ -111,17 +112,16 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: NavigationBar(
|
bottomNavigationBar: SalomonBottomBar(
|
||||||
elevation: 1,
|
currentIndex: selectedIndex,
|
||||||
destinations: _mainController.navigationBars.map((e) {
|
onTap: (value) => setIndex(value),
|
||||||
return NavigationDestination(
|
items: _mainController.navigationBars.map((e) {
|
||||||
|
return SalomonBottomBarItem(
|
||||||
icon: e['icon'],
|
icon: e['icon'],
|
||||||
selectedIcon: e['selectedIcon'],
|
title: Text(e['label']),
|
||||||
label: e['label'],
|
selectedColor: Theme.of(context).colorScheme.primary,
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
selectedIndex: selectedIndex,
|
|
||||||
onDestinationSelected: (value) => setIndex(value),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -902,6 +902,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
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:
|
screen_brightness:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -79,6 +79,7 @@ dependencies:
|
|||||||
url: https://github.com/guozhigq/flutter_meedu_media_kit.git
|
url: https://github.com/guozhigq/flutter_meedu_media_kit.git
|
||||||
ref: feature-custom
|
ref: feature-custom
|
||||||
path: package
|
path: package
|
||||||
|
salomon_bottom_bar: ^3.3.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user