123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import 'package:flutter/material.dart';
- import '../../tools/YSTools.dart';
- class YSTipsAlertView extends StatefulWidget {
- final ValueSetter<bool> valueSetter;
- final String tipsStr;
- final String? btnStr1;
- final String? btnStr2;
- const YSTipsAlertView({Key? key, required this.valueSetter, this.tipsStr = '', this.btnStr1, this.btnStr2}) : super(key: key);
- @override
- YSTipsAlertViewState createState() => YSTipsAlertViewState();
- }
- class YSTipsAlertViewState extends State<YSTipsAlertView> {
- @override
- Widget build(BuildContext context) {
- return Center(
- child: Container(
- width: ysWidth(context)-30,
- height: 150,
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(10))
- ),
- child: LayoutBuilder(
- builder: (context,conSize){
- return Column(
- children: [
- Container(
- height: 100,
- alignment: Alignment.center,
- padding: const EdgeInsets.all(10),
- child: Text(widget.tipsStr,
- style: const TextStyle(fontSize: 15,color: Colors.black,decoration: TextDecoration.none,fontWeight: FontWeight.normal),maxLines: 3,overflow: TextOverflow.ellipsis,),
- ),
- Container(
- height: 50,
- decoration: const BoxDecoration(
- border: Border(top: BorderSide(color: Colors.grey,width: 0.5))
- ),
- child: ListView.separated(
- itemBuilder: (context,index){
- return GestureDetector(
- onTap: (){
- Navigator.pop(context);
- widget.valueSetter(index==1);
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- width: conSize.maxWidth/2-0.25,
- alignment: Alignment.center,
- child: Text(
- index==0?widget.btnStr1??'否':widget.btnStr2??'是',
- style: const TextStyle(fontSize: 15,color: Colors.black,decoration: TextDecoration.none,fontWeight: FontWeight.normal),
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(width: 0.5,color:Colors.grey,);
- },
- itemCount: 2,
- scrollDirection: Axis.horizontal,
- ),
- )
- ],
- );
- },
- ),
- ),
- );
- }
- }
|