Нижняя панель приложений в главном меню с панелью SliverApp - PullRequest
0 голосов
/ 04 августа 2020

Hy, ребята, я пытаюсь разместить нижнюю панель приложения на странице, где находится sliverappbar, но безуспешно .... Мне нужно перелистывать главную страницу с помощью CustomScrolView, и я не знаю, где разместить виджет нижней панели приложения

CustomScrollView(
      slivers: <Widget>[
        SliverAppBar(
          backgroundColor: Colors.purple,
          pinned: false,
          forceElevated: true,
          floating: false,
          title: Text("iBeautik"),
          centerTitle: true,
          actions: <Widget>[
            IconButton(icon: Icon(Icons.apps), onPressed: () {}),
          ],
          expandedHeight: 160,
          flexibleSpace: FlexibleSpaceBar(
            centerTitle: true,
            background: Image.asset(
              'assets/images/sliverImage.jpg',
              fit: BoxFit.cover,
            ),
          ),
        ),
        SliverList(
          delegate: SliverChildListDelegate(
            [
              Container(
                color: Colors.purple,
                child: ListView.builder(

затем нижний бар ..


class _BottomNavState extends State<BottomNav> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        bottomNavigationBar: navigationDrawer(context),
        floatingActionButton: FloatingActionButton(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(50),
                side: BorderSide(color: Color(0xFF1f2032), width: 2)),
            splashColor: Color(0xFF1f2032),
            backgroundColor: Color(0xfffeaf0d),
            child: Icon(
              Icons.add,
              color: Color(0xFF1f2032),
              size: 25,
            ),
            onPressed: () {
            }),
        floatingActionButtonLocation:
        FloatingActionButtonLocation.centerDocked);
  }

  Widget navigationDrawer(BuildContext context) {
            

1 Ответ

1 голос
/ 04 августа 2020

Вы можете установить нижнюю панель как bottomNavigationBar из Scaffold и добавить SilverAppBar как тело Scaffold, например,

@override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      bottomNavigationBar: BottomAppBar(
          child: Container(
            height: 70,
            child: Row(
              mainAxisSize: MainAxisSize.max,
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                IconButton(
                  iconSize: 30.0,
                  icon: Icon(Icons.home),
                  onPressed: () {
                    setState(() {});
                  },
                ),
                IconButton(
                  iconSize: 30.0,
                  icon: Icon(Icons.search),
                  onPressed: () {
                    setState(() {});
                  },
                ),
                IconButton(
                  iconSize: 30.0,
                  icon: Icon(Icons.add),
                  onPressed: () {
                    setState(() {});
                  },
                ),
                IconButton(
                  iconSize: 30.0,
                  icon: Icon(Icons.notifications),
                  onPressed: () {
                    setState(() {});
                  },
                ),
                IconButton(
                  iconSize: 30.0,
                  icon: Icon(Icons.list),
                  onPressed: () {
                    setState(() {});
                  },
                )
              ],
            ),
          )),
      body: NestedScrollView(
          headerSliverBuilder: (BuildContext context, bool innerBoxScrolled) {
            return <Widget>[
              SliverAppBar(
                pinned: true,
                backgroundColor: Colors.deepPurpleAccent,
                title: Text("Silver app bar"),
              ),
            ];
          },
          body: ListView.builder(
              itemCount: itemList.length,
              itemBuilder: (context, index) {
                return Card(
                  child: ListTile(
                    title: Text(itemList[index]),
                  ),
                );
              })),
    );
  }
}

Результат:

res

...