flutter_adaptive_components 0.0.4 flutter_adaptive_components: ^0.0.4 copied to clipboard
根据平台自适应的部件,新增合并单元格
import 'package:flutter/material.dart';
import 'package:flutter_adaptive_components/flutter_adaptive_components.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
List tableTitle = ['q', 'w', 'e', 'r', 't'];
List verticalTableContent = [
{
"content": [
{'a', 's', 'd', 'f', 'g'},
{'z'},
// {'z', 'x', 'c', 'v', 'b'},
{'t', 'y', 'u', 'i', 'o'},
{'g', 'h', 'j', 'k', 'l'},
{'y', 'u', 'i', 'o', 'p'},
],
},
{
"content": [
{'aa', 'ss', 'dd', 'ff', 'gg'},
{'zz'},
// {'zz', 'xx', 'cc', 'vv', 'bb'},
{'tt', 'yy', 'uu', 'ii', 'oo'},
{'gg', 'hh', 'jj', 'kk', 'll'},
{'yy', 'uu', 'ii', 'oo', 'pp'},
],
},
];
return Scaffold(
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
MaterialButton(
color: Theme.of(context).primaryColor,
child: Text('AlertDialog'),
onPressed: () {
showAdaptiveAlert(
context: context,
style: AdaptiveStyle.adaptive,
title: Text('标题'),
content: Text('这是alert_dialog的内容'),
leftText: Text('确认'),
rightText: Text('取消'),
);
},
),
MaterialButton(
color: Theme.of(context).primaryColor,
child: Text('OKDialog'),
onPressed: () {
showAdaptiveOK(
context: context,
style: AdaptiveStyle.adaptive,
title: Text('标题'),
content: Text('这是ok_dialog的内容'),
buttontext: Text('确认'),
);
},
),
MaterialButton(
color: Theme.of(context).primaryColor,
child: Text('BottomSheet'),
onPressed: () {
showAdaptiveSheet(
context: context,
style: AdaptiveStyle.adaptive,
maxheight: 400,
isSafeArea: true,
content: Column(
children: [
Container(
height: 400,
color: Theme.of(context).primaryColor,
),
],
),
);
},
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: CustomTable(
tableTitle: tableTitle,
verticalTableContent: verticalTableContent,
tableMarge: 1,
tableAxis: Axis.horizontal,
tableHeight: 30.0,
),
),
SizedBox(height: 40),
Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: CustomTable(
tableTitle: tableTitle,
verticalTableContent: verticalTableContent,
tableMarge: 1,
tableAxis: Axis.vertical,
tableHeight: 30.0,
),
),
],
),
),
);
}
}