小编mrs*_*sim的帖子

如何使用Flutter创建自定义弹出菜单

我想在应用栏上单击按钮时创建一个弹出菜单..我希望这样的东西出现:

在此处输入图片说明

有办法做到这一点吗?包装还是什么?

dart flutter

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

演练中的下一个和上一个按钮

我正在尝试使用 flutter 包构建一个应用程序介绍演练: transformer_page_view像这样:

return new Scaffold(
    backgroundColor: Color(0xFF202020),
    body: new TransformerPageView(
        loop: true,
        transformer: new ThreeDTransformer(),
        itemBuilder: (BuildContext context, int index) {
          return Container(
            height: MediaQuery.of(context).size.height,
            width: MediaQuery.of(context).size.width,
            color: Colors.white,
            child: Stack(
              children: <Widget>[
                .....
                      ],
                    ),
                  ),
                  alignment: Alignment.bottomCenter,
                )
              ],
            ),
          );
        },
        itemCount: 2));
Run Code Online (Sandbox Code Playgroud)

一切都像我想要的那样工作正常......但是我有一个下一个和上一个按钮......我想要当点击下一步时它会转到索引 = 1,当单击上一个它会转到索引 = 0 ...

我试过这样的事情:

onPressed: () {
   if (index == 0 ){
      loginPage();
   }else{
      setState(() {
        index = 0;
      });
   }
 },
Run Code Online (Sandbox Code Playgroud)

但这不起作用......如何实现这一目标的任何想法?

dart flutter

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

在 fscalendar 中禁用过去的日子

我正在使用 fscalender 并禁用用户选择的日期,如下所示:

        func getUserSelectedDates(_ arrWeekDay: [Int], calender calenderVW: FSCalendar?) -> NSMutableArray {
    let arrUnAvailibilityDates = NSMutableArray()
    let currentDate: Date? = calenderVW?.currentPage
    //get calender
    let gregorianCalendar = Calendar.init(identifier: .gregorian)
    // Start out by getting just the year, month and day components of the current date.
    var components: DateComponents? = nil
    if let aDate = currentDate {
        components = gregorianCalendar.dateComponents([.year, .month, .day, .weekday], from: aDate)
        print(aDate)

    }
    // Change the Day component to 1 (for the first day of the month), …
Run Code Online (Sandbox Code Playgroud)

ios swift fscalendar

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

在底部敲击外部时使底部工作表消失

我的页面中有一个底部工作表。当我点击它的外部时,我想关闭它,如何实现?

我是这样做的:

return new Directionality(
  textDirection: TextDirection.rtl,
  child: new Theme(
    data: theme,
    child: new Scaffold(
      bottomSheet: Container(
        height: MediaQuery.of(context).size.height / 3 + 35,
        color:
            Color(0x00737373), // This line set the transparent background
        child: Padding(
          padding: EdgeInsets.only(right: 10.0, left: 10.0),
          child: Container(
              height: double.infinity,
              width: double.infinity,
              decoration: BoxDecoration(
                  color: Color(0xcc2BA04F),
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(16.0),
                      topRight: Radius.circular(16.0))),
              child: ....
              )),
        ),
      ),
      body: 
        ...
Run Code Online (Sandbox Code Playgroud)

如果我触摸底部工作表的外部,默认情况下它不会关闭。在外面敲击时如何让它消失?

dart flutter

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

以编程方式将滚动视图滚动到其底部

我有一个滚动视图,我试图以编程方式滚动到它的底部..

试过这些:

extension UIScrollView {

// Bonus: Scroll to bottom
func scrollToBottom() {
    let bottomOffset = CGPoint(x: 0, y: contentSize.height - bounds.size.height + contentInset.bottom)
    if(bottomOffset.y > 0) {
        setContentOffset(bottomOffset, animated: true)
    }
}

}
Run Code Online (Sandbox Code Playgroud)

从:

在 Swift 中以编程方式将 UIScrollView 滚动到子 UIView(子视图)的顶部

  let bottomOffset = CGPoint(x: 0, y: scrollView.contentSize.height - scrollView.bounds.size.height)
  scrollView.setContentOffset(bottomOffset, animated: true)
Run Code Online (Sandbox Code Playgroud)

从:

UIScrollView 以编程方式滚动到底部

但两者都没有做任何事情......

怎么做?

xcode ios swift

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

标签 统计

dart ×3

flutter ×3

ios ×2

swift ×2

fscalendar ×1

xcode ×1