tool_chest_title.dart 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. import 'package:fis_i18n/i18n.dart';
  2. import 'package:fis_measure/process/workspace/measure_handler.dart';
  3. import 'package:fis_theme/theme.dart';
  4. import 'package:fis_ui/index.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:get/get.dart';
  7. /// 下拉选择的类
  8. class MeasureSelectModel {
  9. MeasureSelectModel({required this.name, required this.code});
  10. final String name;
  11. final String code;
  12. }
  13. enum TagEnum {
  14. MeasureTool,
  15. NodesTool,
  16. }
  17. /// 工具箱 样式配置之类
  18. class LeftSiderHold extends StatelessWidget implements FWidget {
  19. const LeftSiderHold({Key? key}) : super(key: key);
  20. @override
  21. FWidget build(BuildContext context) {
  22. return FContainer(
  23. width: 300,
  24. padding: const EdgeInsets.symmetric(
  25. horizontal: 10,
  26. vertical: 15,
  27. ),
  28. child: FColumn(
  29. key: UniqueKey(),
  30. mainAxisSize: MainAxisSize.max,
  31. crossAxisAlignment: CrossAxisAlignment.start,
  32. children: [
  33. FRow(
  34. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  35. children: [
  36. // 工具箱文案
  37. FText(
  38. i18nBook.measure.toolbox.t,
  39. style: const TextStyle(
  40. color: Colors.white,
  41. ),
  42. ),
  43. _LeftSiderHoldAllStyleConfig(),
  44. ],
  45. ),
  46. _LeftSiderTabBar(),
  47. _LeftMeasureTools(),
  48. _LeftSelectInput(),
  49. _LeftPulldown(),
  50. ],
  51. ),
  52. );
  53. }
  54. }
  55. /// 测量样式 和配置
  56. class _LeftSiderHoldAllStyleConfig extends StatelessWidget implements FWidget {
  57. @override
  58. FWidget build(BuildContext context) {
  59. return FRow(
  60. children: [
  61. FTextButton(
  62. onPressed: () {
  63. // router.dialog(
  64. // () => PatternDialog(),
  65. // );
  66. },
  67. child: FText(
  68. i18nBook.measure.style.t,
  69. style: TextStyle(
  70. color: FTheme.ins.colorScheme.primary,
  71. ),
  72. ),
  73. ),
  74. FTextButton(
  75. onPressed: () {
  76. // router.dialog(
  77. // () => MeasureconfigurationPage(),
  78. // );
  79. },
  80. child: FText(
  81. i18nBook.measure.config.t,
  82. style: TextStyle(
  83. color: FTheme.ins.colorScheme.primary,
  84. ),
  85. ),
  86. ),
  87. ],
  88. );
  89. }
  90. }
  91. /// 测量工具 注释工具Tab
  92. class _LeftSiderTabBar extends StatefulWidget implements FWidget {
  93. @override
  94. State<_LeftSiderTabBar> createState() => _LeftSiderTabBarState();
  95. }
  96. class _LeftSiderTabBarState extends State<_LeftSiderTabBar> {
  97. final measureHandler = Get.find<MeasureHandler>();
  98. @override
  99. FWidget build(BuildContext context) {
  100. return FRow(
  101. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  102. children: [
  103. _buildTab(
  104. TagEnum.MeasureTool,
  105. i18nBook.measure.measureTool.t,
  106. ),
  107. _buildTab(
  108. TagEnum.NodesTool,
  109. i18nBook.measure.annotationTool.t,
  110. ),
  111. ],
  112. );
  113. }
  114. FWidget _buildTab(TagEnum tag, String title) {
  115. return FTextButton(
  116. style: ButtonStyle(
  117. padding: MaterialStateProperty.all(
  118. const EdgeInsets.all(
  119. 6,
  120. ),
  121. ),
  122. ),
  123. onPressed: () {
  124. print(tag);
  125. measureHandler.changedTab = tag;
  126. setState(() {});
  127. },
  128. child: FText(
  129. title,
  130. style: TextStyle(
  131. color: measureHandler.changedTab == tag
  132. ? FTheme.ins.colorScheme.primary
  133. : Colors.white,
  134. ),
  135. ),
  136. );
  137. }
  138. }
  139. /// 测量方法 Har
  140. class _LeftMeasureTools extends StatelessWidget implements FWidget {
  141. @override
  142. FWidget build(BuildContext context) {
  143. return FContainer(
  144. width: 300,
  145. height: 50,
  146. alignment: Alignment.topCenter,
  147. padding: const EdgeInsets.symmetric(vertical: 8),
  148. child: FGridView.count(
  149. shrinkWrap: true,
  150. crossAxisCount: 4,
  151. crossAxisSpacing: 10,
  152. mainAxisSpacing: 10,
  153. childAspectRatio: 1 / 0.5,
  154. children: [
  155. 'HAR',
  156. ]
  157. .map(
  158. (e) => FContainer(
  159. alignment: Alignment.center,
  160. decoration: BoxDecoration(
  161. border: Border.all(
  162. color: Colors.grey,
  163. ),
  164. ),
  165. child: FText(
  166. e.toString(),
  167. style: const TextStyle(
  168. color: Colors.white,
  169. ),
  170. ),
  171. ),
  172. )
  173. .toList(),
  174. ),
  175. );
  176. }
  177. }
  178. class _LeftSelectInput extends StatelessWidget implements FWidget {
  179. @override
  180. FWidget build(BuildContext context) {
  181. return FContainer(
  182. child: FRow(
  183. children: [
  184. FExpanded(
  185. child: FContainer(
  186. child: FRow(
  187. crossAxisAlignment: CrossAxisAlignment.center,
  188. children: [
  189. FBorderInput(
  190. hintSize: 16,
  191. contentSize: 16,
  192. maxLength: 20,
  193. borderColor: const Color.fromARGB(255, 187, 180, 180),
  194. suffixIcon: FMaterial(
  195. color: Colors.transparent,
  196. child: FIconButton(
  197. onPressed: () {},
  198. icon: const FIcon(
  199. Icons.search,
  200. ),
  201. ),
  202. ),
  203. hintText: i18nBook.common.search.t,
  204. onChanged: (value) {},
  205. ),
  206. ],
  207. ),
  208. ),
  209. ),
  210. ],
  211. ),
  212. );
  213. }
  214. }
  215. class _LeftPulldown extends StatelessWidget implements FWidget {
  216. @override
  217. FWidget build(BuildContext context) {
  218. return FContainer(
  219. margin: const EdgeInsets.symmetric(vertical: 4),
  220. child: FSelect<MeasureSelectModel, String>(
  221. source: [
  222. MeasureSelectModel(
  223. name: 'General',
  224. code: 'General',
  225. )
  226. ],
  227. hintText: i18nBook.measure.selectMeasureItem.t,
  228. value: 'General',
  229. clearable: false,
  230. height: 36,
  231. width: 400,
  232. optionLabelExtractor: (data) => data.name,
  233. optionValueExtractor: (data) => data.code,
  234. onSelectChanged: (value, index) {},
  235. ),
  236. );
  237. }
  238. }