| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- import 'package:bbyyy/my_tools/event_bus.dart';
- import 'package:bbyyy/my_tools/my_colors.dart';
- import 'package:bbyyy/my_tools/my_tools.dart';
- import 'package:bbyyy/paegs/release_goods_page/release_goods_page.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_svg/svg.dart';
- class RootPageView1 {
- //私有构造函数
- RootPageView1._internal();
- //保存单例
- static RootPageView1 _singleton = RootPageView1._internal();
- //工厂构造函数
- factory RootPageView1() => _singleton;
- bool toTop = false;
- var bNText = ['首页', '货帮', '消息', '我的', '顶部'];
- var bNTextIcon = [
- ['images/svg/发现1.svg', 'images/svg/发现2.svg', 'images/svg/顶部.svg'],
- ['images/svg/货帮1.svg', 'images/svg/货帮2.svg'],
- ['images/svg/消息1.svg', 'images/svg/消息2.svg'],
- ['images/svg/我的1.svg', 'images/svg/我的2.svg']
- ];
- int bNIndex = 0;
- bottomNavigationBar1() {
- return StatefulBuilder(
- builder: (BuildContext context, void Function(void Function()) setState) {
- EventBus().on('ChangePage', (arg) {
- setState(() {});
- });
- return Stack(
- alignment: Alignment.bottomCenter,
- children: [
- Container(
- height: 51,
- decoration: BoxDecoration(boxShadow: [
- BoxShadow(
- color: MyColors.c7FE1E1E1,
- blurRadius: 5.0,
- ),
- ]),
- ),
- Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(30)),
- boxShadow: [
- BoxShadow(
- color: MyColors.c7FE1E1E1,
- blurRadius: 5.0,
- ),
- ]),
- height: 60,
- width: 60,
- ),
- Container(
- color: Colors.white,
- height: 51,
- alignment: Alignment.center,
- child: Row(
- children: [
- Expanded(
- child: Row(
- children: [
- getButton(0),
- getButton(1),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- ),
- ),
- Container(
- width: 60,
- ),
- Expanded(
- child: Row(
- children: [
- getButton(2),
- getButton(3),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- ),
- )
- ],
- ),
- ),
- GestureDetector(
- onTap: () {
- MyTools().toPage(context, ReleaseGoodsPage(null), (then) {});
- },
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(30))),
- height: 60,
- width: 60,
- alignment: Alignment.center,
- child: SvgPicture.asset(
- 'images/svg/发布.svg',
- height: 44,
- width: 44,
- ),
- ),
- behavior: HitTestBehavior.translucent,
- )
- ],
- );
- },
- );
- }
- bottomNavigationBar() {
- return StatefulBuilder(
- builder: (BuildContext context, void Function(void Function()) setState) {
- EventBus().on('ChangePage', (arg) {
- setState(() {});
- });
- return Container(
- height: 51,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: MyColors.c7FE1E1E1,
- blurRadius: 5.0,
- ),
- ],
- color: Colors.white,
- ),
- alignment: Alignment.center,
- child: Row(
- children: [
- getButton(0),
- getButton(1),
- getButton(2),
- getButton(3),
- ],
- ),
- );
- },
- );
- }
- getButton(int i) {
- return Expanded(
- child: GestureDetector(
- onTap: () {
- if (bNIndex == 0 && toTop && i == 0) {
- toTop = false;
- EventBus().emit('toTop');
- }
- if (i != 0) {
- EventBus().emit('toLogin');
- }
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Container(
- child: SvgPicture.asset(bNIndex == 0 && toTop && i == 0
- ? bNTextIcon[i][2]
- : bNTextIcon[i][bNIndex == i ? 0 : 1]),
- height: 20,
- width: 20,
- ),
- Text(
- bNIndex == 0 && toTop && i == 0 ? bNText[4] : bNText[i],
- style: TextStyle(
- color: bNIndex == i ? MyColors.cFF4233 : MyColors.c999999,
- fontSize: 10),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.center,
- ),
- ),
- ),
- );
- }
- }
|