import 'package:flutter/material.dart';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:day_dream/utils/translate_util.dart' as T;
import 'package:day_dream/common/utils/px_utils.dart';
class MainRecommendCity extends StatefulWidget {
@override
_MainRecommendCityState createState() => _MainRecommendCityState();
}
class _MainRecommendCityState extends State<MainRecommendCity>
with SingleTickerProviderStateMixin {
TextStyle tabStyle = TextStyle(fontSize: sp(36), fontWeight: FontWeight.w400);
TabController _tabController2;
List tabs = ["全部", "男生", "女生"];
List list=["确认","取消"];
TabController _tabController;//初始化、、、
@override
void initState() {
super.initState();
// 创建Controller
_tabController = TabController(length: tabs.length, vsync: this);//初始化
// _tabController2=TabController(length: list.length, vsync: this);
//设置点击事件
_tabController.addListener(() {
switch (_tabController.index) {
case 1:
break;
case 2:
break;
case 3:
break;
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("附近搜索"),
actions: <Widget>[
IconButton(
icon: Icon(Icons.settings, color: Colors.white), //自定义图标
onPressed: () {
// 打开抽屉菜单
// Scaffold.of(context).openDrawer();
showModalBottomSheet(
context: context,
isScrollControlled: false,
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10))),
builder: (BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text("筛选设置"),
Align(
alignment: Alignment.centerLeft,
// left:1.0,
child: Text("想看到的用户")),
Center(
child: TabBar(
controller: _tabController,
tabs: tabs.map((e) => Tab(text: e)).toList()
,
indicator: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(w(100))),//圆角
color: Color.fromARGB(255, 0x15, 0x15, 0x15)),
labelColor: Colors.white,
unselectedLabelColor:
Color.fromARGB(255, 0x15, 0x15, 0x15),
),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Expanded(flex: 1, child:
// OutlineButton(
// child: Text("全部"),
// shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
// onPressed: () {},
// )),
// Expanded(flex: 1, child:
// OutlineButton(
// child: Text("男性"),
// shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
// onPressed: () {},
// )),
// Expanded(
// flex: 1,
// child: OutlineButton(
// child: Text("女性"),
// // highlightColor :Colors.black,
// shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
// onPressed: () {},
// )),
// ]
//
// ),
),
Center(
child:
// TabBar(
// controller: _tabController2,
// tabs: list.map((e) => Tab(text: e)).toList()
//
//
// ,
// indicator: BoxDecoration(
// borderRadius:
// BorderRadius.all(Radius.circular(w(100))),
// color: Color.fromARGB(255, 0x15, 0x15, 0x15)),
// labelColor: Colors.white,
// unselectedLabelColor:
// Color.fromARGB(255, 0x15, 0x15, 0x15),
// ),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
flex: 1,
child: Align(
alignment: Alignment.bottomLeft,
child: OutlineButton(
child: Text("取消"),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(20.0)),
onPressed: () {},
))),
Expanded(
flex: 1,
child: Align(
alignment: Alignment.bottomRight,
child: OutlineButton(
disabledBorderColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
20.0)), //圆角
child: Text("确认"),
onPressed: () {},
)))
],
),
),
],
);
});
},
)
],
),
body:AmapView()//Text("1")// AmapView(),
);
}
}
flutter tabbar
最新推荐文章于 2024-04-09 16:48:37 发布