我正在尝试使用 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)
但这不起作用......如何实现这一目标的任何想法?
我正在使用 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) 我的页面中有一个底部工作表。当我点击它的外部时,我想关闭它,如何实现?
我是这样做的:
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)
如果我触摸底部工作表的外部,默认情况下它不会关闭。在外面敲击时如何让它消失?
我有一个滚动视图,我试图以编程方式滚动到它的底部..
试过这些:
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)
从:
但两者都没有做任何事情......
怎么做?