sqllite database save magnetic declination data

This commit is contained in:
cxc
2022-06-30 17:01:04 +08:00
parent d962dc8023
commit c7ccf28e9f
11 changed files with 173 additions and 166 deletions

View File

@ -71,100 +71,14 @@ class RegionSelector extends StatelessWidget {
],
)),
),
const SizedBox(
height: 20,
),
Text(
'磁偏角 : ${regionProvider.tempDeclination}°',
style: const TextStyle(fontSize: 24),
)
],
)));
}
}
// class RegionSelector extends StatefulWidget {
// const RegionSelector({Key key}) : super(key: key);
//
// @override
// State<RegionSelector> createState() => _RegionSelectorState();
// }
//
// class _RegionSelectorState extends State<RegionSelector> {
// final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
//
// // final rp = RegionProvider()
// String provinceName;
// String cityName;
//
// @override
// initState() {
// // provinceName = Provider.of<RegionProvider>(context).provinceName;
// // cityName = Provider.of<RegionProvider>(context).cityName;
// _prefs.then((prefs) {
// if (prefs.getString('REGION') != null) {
// final region =
// RegionData.fromJson(jsonDecode(prefs.getString('REGION')));
// provinceName = region.provinceName;
// cityName = region.cityName;
// }
// });
// }
//
// // 拼接城市
// String spliceCityName(String pname, String cname) {
// if (pname == '') return '未选择城市';
// StringBuffer sb = StringBuffer();
// sb.write(pname);
// if (cname == '') return sb.toString();
// sb.write(' - ');
// sb.write(cname);
// return sb.toString();
// }
//
// @override
// Widget build(BuildContext context) {
// return SizedBox(
// height: 100,
// child: Consumer<RegionProvider>(
// builder: (context, regionProvider, child) => Column(
// children: [
// InkWell(
// onTap: () {
// Pickers.showAddressPicker(context,
// addAllItem: false,
// initProvince: regionProvider.provinceName,
// initCity: regionProvider.cityName,
// onConfirm: (p, c, t) {
// regionProvider.updateRegion(p, c);
// setState(() {
// provinceName = p;
// cityName = c;
// });
// });
// },
// child: Container(
// constraints: const BoxConstraints(minHeight: 42),
// padding: const EdgeInsets.fromLTRB(10, 0, 12, 0),
// decoration: BoxDecoration(
// border: Border.all(color: Colors.grey),
// borderRadius: BorderRadius.circular(6),
// ),
// child: Row(
// // mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(spliceCityName(regionProvider.provinceName,
// regionProvider.cityName)),
// // SizedBox(width: 8),
// Row(
// children: [
// InkWell(
// child: Icon(Icons.close,
// size: 20, color: Colors.grey[500]),
// onTap: () {}),
// Icon(Icons.keyboard_arrow_down,
// size: 28, color: Colors.grey[500]),
// ],
// )
// ],
// )),
// ),
// ],
// )));
// }
// }