我想要的是:
我的小工具:
class Buttons extends StatelessWidget {
const Buttons({
Key key,
@required this.selectBloc,
@required this.selectStatus,
}) : super(key: key);
final SelectBloc selectBloc;
final int selectStatus;
@override
Widget build(BuildContext context) {
return BlocBuilder<SelectBloc, SelectState>(
bloc: selectBloc,
builder: (context, state) {
return OutlinedButton(
onPressed: () {
},
child: Text( dynamic, style: TextStyle(color: Colors.grey[500])),
style: ButtonStyle(
side: MaterialStateProperty.all(BorderSide(
color: state.statusSelected == selectStatus
? Colors.blue
: Colors.grey)),
),
);
});
}
}
我用它:
Buttons(
selectBloc: selectBloc,
selectStatus: 0,
),
Buttons(
selectBloc: selectBloc,
selectStatus: 1,
),