小编Jah*_*lam的帖子

flutter 中 PopupMenuButton 的自定义形状

我想在 flutter 中更改 PopupMenuButton 的形状,想在顶部添加一个三角形,如下图所示,我在 google 上花了很多时间,但没有取得任何成就,请帮助我,我是 flutter 新手,所以我不这样做知道如何更改此默认容器,现在它只有白色圆形容器,白色箭头/三角形未添加在其顶部。请帮忙,提前致谢

 popUpMenu= PopupMenuButton<String>(
     key: _menuKey,
     offset: Offset(50,100),
     padding: EdgeInsets.all(0.0),
     onSelected: (value) {
       if (value == "Tax & Additional Charges") {
         endDrawerController.drawerKey.value =
             EndDrawerKeys.TaxAndAdditionalChargesEndDrawer;
         endDrawerController.scaffoldKey.currentState.openEndDrawer();
         print("Entering in tax");
       } else if (value == "Hold this Invoice") {
         endDrawerController.drawerKey.value =
             EndDrawerKeys.HoldInvoiceEndDrawer;
         endDrawerController.scaffoldKey.currentState.openEndDrawer();
       }
     },
     shape: RoundedRectangleBorder(
         borderRadius: BorderRadius.all(Radius.circular(10.h))),
     itemBuilder: (context) => [
       PopupMenuItem(
         value: "Tax & Additional Charges",
         child: popUpMenuSingleItem(
             icon: AppAssets.DeliveryIcon,
             text: "Tax & Additional Charges",
             topMargin: 15.h),
       ),
       PopupMenuItem(
         value: "Hold this …
Run Code Online (Sandbox Code Playgroud)

customization shapes popupmenubutton flutter triangle

8
推荐指数
1
解决办法
9491
查看次数

Flutter中有没有办法让文本和下划线颜色不同?

有没有办法让文本颜色为白色,而下划线为黄色?

RichText、TextSpan 或 Text 似乎没有机会执行此操作。

这就是我正在寻找的。

在此输入图像描述

user-interface flutter

7
推荐指数
1
解决办法
8953
查看次数

如何忽略“提升按钮”上的“标签”?

我想制作一个以图标为中心的按钮。

该图像是当前图像。

这是我的代码。

ElevatedButton.icon(
                    onPressed: () {},
                    icon: Icon(Icons.arrow_forward),
                    label: Text(''),
                    style: ElevatedButton.styleFrom(
                      primary: Colors.red,
                      fixedSize: Size(100, 50),
                    )
Run Code Online (Sandbox Code Playgroud)

flutter

4
推荐指数
2
解决办法
4495
查看次数

无效的常量值.dart(invalid_constant)

在下面的代码中,我在“controller: urlController”这一行上收到错误

      var url;
      final urlController = TextEditingController();
    
      @override
      void dispose() {
        urlController.dispose();
        super.dispose();
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            backgroundColor: const Color(0xff16352A),
            title: const Text(
              'Downloader',
              style: TextStyle(color: Color(0xffEDAB24)),
            ),
          ),
          body: Container(
            padding: const EdgeInsets.all(20.0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                const SizedBox(height: 50.0),
                const TextField(
                  controller: urlController,
                  decoration: InputDecoration(
                    border: OutlineInputBorder(),
                    labelText: 'Paste URL',
                  ),
                ),
            

const SizedBox(height: 20.0),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                TextButton(
                  onPressed: () {},
                  child: const Text(
                    'Download',
                    style: …
Run Code Online (Sandbox Code Playgroud)

textfield dart flutter flutter-text flutter-textinputfield

3
推荐指数
1
解决办法
3765
查看次数

flutter:如何使用官方 webview_flutter 包进行下拉刷新 flutter webview

我想在 flutter web 视图中添加复习内容

 Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          title: Stack(
        children: <Widget>[
          Container(
            child: Center(
              child: Text(_title),
            ),
          ),
        ],
      )),
      body: SafeArea(
          child: WebView(
              key: _key,
              javascriptMode: JavascriptMode.unrestricted,
              initialUrl: _url)),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

webview flutter

2
推荐指数
1
解决办法
3625
查看次数

如何增加颤振中 DropdownButton 中文本和箭头之间的空白?

DropdownButton(
  value: dropDownValue1,
  onChanged: (String? newValue) {
    setState(() {
      dropDownValue1 = newValue!;
    });
  },
  items: <String>[
    'Work At Office',
    'Work From Home',
  ].map<DropdownMenuItem<String>>((String value) {
    return DropdownMenuItem<String>(
      value: value,
      child: Text(value),
    );
  }).toList(),
)
Run Code Online (Sandbox Code Playgroud)

如何增加箭头和文本之间的间距

现在

我希望我能做到这样,该怎么做呢?

所需输出

提前致谢

flutter

2
推荐指数
1
解决办法
2002
查看次数

在 macOS montery 12.1 上安装版本 13.2 时 xcode 卡住

从 AppStore 下载了新的 Xcode 13.2 版本,安装过程卡住了超过 16 个小时。

当卡住的时候如何摆脱这个呢?

xcode cross-platform react-native flutter

2
推荐指数
1
解决办法
3773
查看次数

如何在共享首选项中存储字符串列表?并在小部件中打印该列表?

我是颤振新手,无法将数据存储在共享首选项中,实际上我正在处理小项目,现在我坚持将数据存储在共享首选项中以供以后使用,所以任何人有任何想法请帮助我......!谢谢。这是我的代码:

    import 'package:flutter/material.dart';
    import 'home.dart';

    class Result extends StatelessWidget {
    final String selectedLevel;
    final String timeTakenInmin;
    Result({Key key, @required this.selectedLevel,@required this.timeTakenInmin}) : 
    super(key: key);

    @override
    Widget build(BuildContext context) {
      var size = MediaQuery.of(context).size;
      return WillPopScope(
        onWillPop: () =>Future.value(false),
        child: Scaffold(
          body: Center(
              child: Column(
                children: [
                  Expanded(flex:2,child: LayoutBuilder(
                    builder: (context,constraints) => Container(
                      color: Color(0xFF317C84),
                      child: Center(
                        child: Text('Your Result',style: TextStyle(
                            color: Colors.black54,fontWeight: FontWeight.bold,fontSize: 30
                        ),),
                      ),
                    ),
                  )),
                  Expanded(flex:1,child: LayoutBuilder(
                  builder: (context,constraints) => Container(
                    decoration: BoxDecoration(
                        image: DecorationImage(
                          image: AssetImage("assets/reporticon.png",),scale: …
Run Code Online (Sandbox Code Playgroud)

sharedpreferences flutter

1
推荐指数
1
解决办法
1181
查看次数