关闭按钮不起作用,找不到将其向下移动一点的行

问题描述 投票:0回答:1

我有一个用 flutter 制作的测验应用程序,但我找不到我将在此处附加的关闭图标所在的行。我尝试将第一个 SizedBox 更改为 30,但“x”仍然没有移动。我应该在哪里添加另一个 SizedBox?这是代码

import 'package:flutter/material.dart';
import 'package:bacgeografie/models/quiz_data.dart';
import 'package:bacgeografie/utils/string.dart';
import 'package:nb_utils/nb_utils.dart';

class QuizDescriptionComponent extends StatefulWidget {
  static String tag = '/QuizDescriptionComponent';

  final QuizData? quizModel;

  const QuizDescriptionComponent({Key? key, this.quizModel}) : super(key: key);

  @override
  QuizDescriptionComponentState createState() =>
      QuizDescriptionComponentState();
}

class QuizDescriptionComponentState extends State<QuizDescriptionComponent> {
  // String university = 'Any';
  @override
  void initState() {
    super.initState();
    init();
  }

  init() async {
    //
  }

  @override
  void setState(fn) {
    if (mounted) super.setState(fn);
  }

  @override
  Widget build(BuildContext context) {
    
    return SingleChildScrollView(
      
      child: Column(
        
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const SizedBox(height: 30),
          widget.quizModel!.imageUrl.isEmptyOrNull
              ? Image.network(
                  widget.quizModel!.imageUrl!,
                  width: context.width(),
                  height: context.height() * 0.50,
                  fit: BoxFit.fill,
                ).cornerRadiusWithClipRRectOnly(
                  bottomLeft: defaultRadius.toInt(),
                  bottomRight: defaultRadius.toInt())
              : Container(),
          50.height,
          Text('About this quiz', style: boldTextStyle(size: 20))
              .paddingOnly(left: 25, right: 30),
          SizedBox(height: 10),
          Container(
            margin: const EdgeInsets.all(25),
            padding: const EdgeInsets.all(25),
            width: context.width(),
            decoration: boxDecorationWithRoundedCorners(
              borderRadius: BorderRadius.circular(defaultRadius),
              border: Border.all(color: grey.withOpacity(0.3)),
              backgroundColor: Theme.of(context).cardColor,
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text('Quiz title', style: boldTextStyle()),
                8.height,
                Text(widget.quizModel!.quizTitle.validate(),
                    style: primaryTextStyle()),
                8.height,
                Divider(color: grey.withOpacity(0.3), thickness: 1),
                8.height,
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(lbl_quiz_description, style: boldTextStyle()),
                    8.height,
                    Text(widget.quizModel!.description.validate(),
                        style: primaryTextStyle()),
                    8.height,
                    Divider(color: grey.withOpacity(0.3), thickness: 1),
                    8.height,
                  ],
                ).visible(widget.quizModel!.description.validate().isNotEmpty),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('No of questions' + ":", style: boldTextStyle()),
                    4.width,
                    Text('20', softWrap: true, style: primaryTextStyle())
                        .expand(),
                  ],
                ),
                8.height,
                Divider(color: grey.withOpacity(0.3), thickness: 1),
                8.height,
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('Quiz duration', style: boldTextStyle()),
                    4.width,
                    Text('20' + " minutes",
                            softWrap: true, style: primaryTextStyle())
                        .expand(),
                  ],
                ),
                // 8.height,
                // Divider(color: grey.withOpacity(0.3), thickness: 1),
                // 8.height,
                // Text('Choose University', style: boldTextStyle()),
                // 8.height,
                // DropdownButtonFormField(
                //   decoration: InputDecoration(
                //       border: OutlineInputBorder(
                //           borderSide: BorderSide(color: black))),
                //   value: university,
                //   items: ['Any', '1', '2', '3']
                //       .map((label) => DropdownMenuItem(
                //             child: Text(label.toString()),
                //             value: label,
                //           ))
                //       .toList(),
                //   onChanged: (value) {
                //     setState(() {
                //       university = value.toString();
                //     });
                //   },
                // ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

image

我将第一个沙箱更改为 30 ,但只有“关于此测验”移动了

flutter dart button icons
1个回答
0
投票

好像它在你班级之外的某个地方。在代码中搜索

AppBar
,在
AppBar
内,您可能会在
actions
小部件列表下或在
title
小部件中找到它。如下所示。祝你好运!

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: 'Maybe here'
        actions: [...or here],

...
© www.soinside.com 2019 - 2024. All rights reserved.