view.dart 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. import 'package:electronic_assistant/base/base_controller.dart';
  2. import 'package:electronic_assistant/base/base_page.dart';
  3. import 'package:electronic_assistant/resource/colors.gen.dart';
  4. import 'package:electronic_assistant/resource/string.gen.dart';
  5. import 'package:electronic_assistant/router/app_pages.dart';
  6. import 'package:electronic_assistant/utils/common_style.dart';
  7. import 'package:electronic_assistant/utils/expand.dart';
  8. import 'package:flutter/material.dart';
  9. import 'package:flutter/src/widgets/framework.dart';
  10. import 'package:flutter_screenutil/flutter_screenutil.dart';
  11. import 'package:get/get.dart';
  12. import 'package:get/get_core/src/get_main.dart';
  13. import '../../resource/assets.gen.dart';
  14. import 'controller.dart';
  15. class ShortCutPage extends BasePage<ShortCutController> {
  16. const ShortCutPage({super.key});
  17. static Future? start() {
  18. return Get.toNamed(RoutePath.recordShortcut);
  19. }
  20. @override
  21. Color backgroundColor() {
  22. return '#F6F6F6'.color;
  23. }
  24. @override
  25. Widget buildBody(BuildContext context) {
  26. return Scaffold(
  27. backgroundColor: Colors.transparent,
  28. appBar: _buildAppBar(),
  29. body: _buildShortcutContainer());
  30. }
  31. Widget _buildShortcutContainer() {
  32. return SingleChildScrollView(
  33. child: Container(
  34. padding: EdgeInsets.all(12.w),
  35. margin: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.w),
  36. decoration: const BoxDecoration(
  37. color: Colors.white,
  38. borderRadius: BorderRadius.all(Radius.circular(12)),
  39. ),
  40. child: Column(
  41. children: [
  42. SizedBox(height: 8.w),
  43. Row(
  44. children: [
  45. getStep('1'),
  46. SizedBox(width: 6.w),
  47. Text(
  48. '点击',
  49. style: TextStyle(
  50. fontSize: 14.sp, color: ColorName.primaryTextColor),
  51. ),
  52. Text(
  53. '【添加快捷指令】',
  54. style: TextStyle(
  55. fontSize: 14.sp, color: ColorName.colorPrimary),
  56. ),
  57. ],
  58. ),
  59. SizedBox(height: 32.w),
  60. GestureDetector(
  61. onTap: controller.onAddIosShortCut,
  62. child: Container(
  63. width: 240.w,
  64. height: 48.w,
  65. decoration: getCommonDecoration(8.w),
  66. child: Center(
  67. child: Text('添加快捷方式',
  68. style: TextStyle(
  69. fontSize: 16.sp, color: ColorName.white)))),
  70. ),
  71. SizedBox(height: 32.w),
  72. Row(
  73. children: [
  74. getStep('2'),
  75. SizedBox(width: 6.w),
  76. Text(
  77. '依照教程,设置权限',
  78. style: TextStyle(
  79. fontSize: 14.sp, color: ColorName.primaryTextColor),
  80. )
  81. ],
  82. ),
  83. SizedBox(height: 12.w),
  84. Container(
  85. padding: EdgeInsets.only(left: 32.w),
  86. child: _buildTwoStepDesc(),
  87. ),
  88. SizedBox(height: 12.w),
  89. Container(
  90. margin: EdgeInsets.only(left: 24.w),
  91. child: GestureDetector(
  92. onTap: controller.onShowIosShortcutVideo,
  93. child: AspectRatio(
  94. aspectRatio: 852 / 444,
  95. child: Assets.images.bgIosShortcutVideoPreview.image()),
  96. ),
  97. ),
  98. SizedBox(height: 32.w),
  99. Row(
  100. children: [
  101. getStep('3'),
  102. SizedBox(width: 6.w),
  103. Text(
  104. '快点下手机背面,体验快捷录音吧~',
  105. style: TextStyle(
  106. fontSize: 14.sp, color: ColorName.primaryTextColor),
  107. )
  108. ],
  109. ),
  110. SizedBox(height: 8.w),
  111. ],
  112. )));
  113. }
  114. Widget _buildTwoStepDesc() {
  115. return Column(
  116. children: [
  117. Row(
  118. crossAxisAlignment: CrossAxisAlignment.start,
  119. children: [
  120. Container(
  121. decoration: const BoxDecoration(
  122. color: ColorName.secondaryTextColor,
  123. shape: BoxShape.circle,
  124. ),
  125. width: 3.w,
  126. height: 3.w,
  127. margin: EdgeInsets.only(right: 10.w, top: 8.w),
  128. ),
  129. Expanded(
  130. child: RichText(
  131. text: TextSpan(
  132. style: TextStyle(
  133. fontSize: 13.sp, color: ColorName.secondaryTextColor),
  134. children: const [
  135. TextSpan(text: "在手机"),
  136. TextSpan(
  137. text: "【设置】",
  138. style: TextStyle(color: ColorName.colorPrimary)),
  139. TextSpan(text: "中点击"),
  140. TextSpan(
  141. text: "【辅助功能】",
  142. style: TextStyle(color: ColorName.colorPrimary)),
  143. TextSpan(text: "-"),
  144. TextSpan(
  145. text: "【触控】",
  146. style: TextStyle(color: ColorName.colorPrimary)),
  147. TextSpan(text: ",滑动至底部找到"),
  148. TextSpan(
  149. text: "【轻点背面】",
  150. style: TextStyle(color: ColorName.colorPrimary)),
  151. ])),
  152. )
  153. ],
  154. ),
  155. Row(
  156. crossAxisAlignment: CrossAxisAlignment.start,
  157. children: [
  158. Container(
  159. decoration: const BoxDecoration(
  160. color: ColorName.secondaryTextColor,
  161. shape: BoxShape.circle,
  162. ),
  163. width: 3.w,
  164. height: 3.w,
  165. margin: EdgeInsets.only(right: 10.w, top: 8.w),
  166. ),
  167. Expanded(
  168. child: RichText(
  169. text: TextSpan(
  170. style: TextStyle(
  171. fontSize: 13.sp, color: ColorName.secondaryTextColor),
  172. children: const [
  173. TextSpan(text: "进入"),
  174. TextSpan(
  175. text: "【轻点背面】",
  176. style: TextStyle(color: ColorName.colorPrimary)),
  177. TextSpan(text: ",找到"),
  178. TextSpan(
  179. text: "【轻点两下/三下】",
  180. style: TextStyle(color: ColorName.colorPrimary)),
  181. TextSpan(text: ",选"),
  182. TextSpan(
  183. text: "【--小听快听】",
  184. style: TextStyle(color: ColorName.colorPrimary)),
  185. ])),
  186. )
  187. ],
  188. )
  189. ],
  190. );
  191. }
  192. Widget getStep(String step) {
  193. return Container(
  194. width: 20.w,
  195. height: 20.w,
  196. decoration: const BoxDecoration(
  197. color: ColorName.colorPrimary, // Set the background color
  198. shape: BoxShape.circle, // Set the shape to circle
  199. ),
  200. child: Center(
  201. child: Text(step,
  202. style:
  203. TextStyle(fontSize: 14.sp, color: ColorName.white, height: 1)),
  204. ),
  205. );
  206. }
  207. AppBar _buildAppBar() {
  208. return AppBar(
  209. scrolledUnderElevation: 0,
  210. leading: IconButton(
  211. icon: SizedBox(
  212. width: 24.w,
  213. height: 24.w,
  214. child: Assets.images.iconRecordShortcutPageClose.image()),
  215. // Custom icon
  216. onPressed: () {
  217. Get.back();
  218. },
  219. ),
  220. title: Text(StringName.recordShortcutTitle.tr,
  221. style: TextStyle(
  222. fontSize: 17.sp,
  223. color: ColorName.primaryTextColor,
  224. fontWeight: FontWeight.bold)),
  225. centerTitle: true,
  226. backgroundColor: Colors.transparent,
  227. elevation: 0,
  228. );
  229. }
  230. }