【发布时间】:2022-10-21 14:07:28
【问题描述】:
我在 Flutter 中为我的网站构建了一个导航栏,如下面的代码所示。我想做的就是让这个导航栏响应移动版本。我希望在移动版本中显示一个菜单图标,并且我的页面文本应该消失,当我点击这个菜单图标时我可以看到它。有谁知道我该怎么做?
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF262533),
body: ListView(
children: [
Stack(
children: [
Container(
height: Get.height * .65, width: Get.width,
color: const Color(0xFF262533),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
const Padding(
padding: EdgeInsets.all(18.0),
),
SizedBox(
height: 80,
width: 185,
child: Image.asset('assets/images/logo2.png'),
),
const Spacer(),
const Text(
"Escorts",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Poppins',
),
),
const SizedBox(
width: 32,
),
const Text(
"Angenturen & Clubs",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Poppins',
),
),
const SizedBox(
width: 32,
),
const Text(
"Inserieren",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Poppins',
),
),
const SizedBox(
width: 32,
),
const Text(
"Werben",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Poppins',
),
),
const SizedBox(
width: 32,
),
const Text(
"Blog",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Poppins',
),
),
const SizedBox(
width: 32,
),
const Text(
"Kontakt",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Poppins',
),
),
const Spacer(),
const Icon(
Icons.attach_money,
color: Colors.white,
),
const SizedBox(
width: 20,
),
const Icon(
Icons.chat,
color: Colors.white,
),
const SizedBox(
width: 20,
),
const Icon(
Icons.person,
color: Colors.white,
),
const SizedBox(
width: 20,
),
const Icon(
Icons.search,
color: Colors.white,
),
const SizedBox(
width: 32,
),
],
),
),
],
),
【问题讨论】:
标签: flutter flutter-layout flutter-dependencies flutter-web flutter-animation