view.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. import 'package:electronic_assistant/base/base_page.dart';
  2. import 'package:electronic_assistant/module/record/controller.dart';
  3. import 'package:electronic_assistant/resource/colors.gen.dart';
  4. import 'package:electronic_assistant/utils/expand.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:flutter/services.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'package:get/get.dart';
  9. import '../../resource/assets.gen.dart';
  10. import '../../widget/frame_animation_view.dart';
  11. class RecordPage extends BasePage<RecordController> {
  12. const RecordPage({super.key});
  13. @override
  14. bool immersive() {
  15. return true;
  16. }
  17. @override
  18. bool statusBarDarkFont() {
  19. return false;
  20. }
  21. @override
  22. Color backgroundColor() {
  23. return ColorName.recordBackgroundColor;
  24. }
  25. @override
  26. Color navigationBarColor() {
  27. return "#4A4F67".color;
  28. }
  29. @override
  30. Widget buildBody(BuildContext context) {
  31. return Stack(alignment: Alignment.bottomCenter, children: [
  32. _buildBottomGradient(),
  33. Scaffold(
  34. appBar: AppBar(
  35. leading: IconButton(
  36. icon: const Icon(Icons.arrow_back_ios_new_rounded),
  37. color: ColorName.white,
  38. onPressed: () {
  39. Navigator.pop(context);
  40. },
  41. ),
  42. scrolledUnderElevation: 0,
  43. backgroundColor: ColorName.transparent,
  44. systemOverlayStyle: SystemUiOverlayStyle.light,
  45. actions: [
  46. _buildAddShortcut(false),
  47. ],
  48. ),
  49. backgroundColor: ColorName.transparent,
  50. body: Flex(
  51. direction: Axis.vertical,
  52. children: [
  53. _buildRecordStatus(),
  54. const Spacer(flex: 271),
  55. _buildRecordAnim(),
  56. const Spacer(flex: 407),
  57. _buildRecordControl(),
  58. ],
  59. ),
  60. ),
  61. ]);
  62. }
  63. Widget _buildAddShortcut(bool visible) {
  64. return GestureDetector(
  65. onTap: () {
  66. controller.addShortcut();
  67. },
  68. child: Visibility(
  69. visible: visible,
  70. child: Row(
  71. children: [
  72. Image(
  73. image: Assets.images.iconRecordAddShortcut.provider(),
  74. width: 24.w,
  75. height: 24.w),
  76. Padding(
  77. padding: EdgeInsets.only(left: 8.w, right: 16.w),
  78. child: Text(
  79. '添加到桌面',
  80. style: TextStyle(color: ColorName.white, fontSize: 14.w),
  81. ),
  82. )
  83. ],
  84. ),
  85. ),
  86. );
  87. }
  88. Widget _buildRecordStatus() {
  89. return Container(
  90. padding: EdgeInsets.symmetric(horizontal: 16.w),
  91. margin: EdgeInsets.only(top: 20.w),
  92. child: Row(
  93. children: [
  94. Container(
  95. margin: EdgeInsets.only(right: 8.w),
  96. child: Image(
  97. image: Assets.images.iconRecordLogo.provider(),
  98. width: 45.w,
  99. height: 48.w),
  100. ),
  101. Obx(() {
  102. return Text(
  103. controller.recordStatus.value,
  104. style: TextStyle(color: ColorName.white, fontSize: 17.w),
  105. );
  106. }),
  107. ],
  108. ),
  109. );
  110. }
  111. Widget _buildRecordAnim() {
  112. return FrameAnimationView(
  113. framePath: 'assets/anim/anim_recording.zip',
  114. speed: 2,
  115. width: 360.w,
  116. height: 180.w,
  117. );
  118. }
  119. Widget _buildRecordControl() {
  120. return Stack(
  121. alignment: Alignment.bottomCenter,
  122. children: [
  123. Container(
  124. padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 30.w),
  125. decoration: BoxDecoration(
  126. color: "#4A4F67".color,
  127. borderRadius: BorderRadius.only(
  128. topLeft: Radius.circular(40.w),
  129. topRight: Radius.circular(40.w)),
  130. ),
  131. child: Row(
  132. children: [
  133. Image(
  134. image: Assets.images.iconRecordCancelDisable.provider(),
  135. width: 56.w,
  136. height: 56.w),
  137. const Spacer(),
  138. Image(
  139. image: Assets.images.iconRecordSaveDisable.provider(),
  140. width: 56.w,
  141. height: 56.w),
  142. ],
  143. ),
  144. ),
  145. Column(
  146. children: [
  147. Image(
  148. image: Assets.images.iconRecordStart.provider(),
  149. width: 92.w,
  150. height: 92.w),
  151. Padding(
  152. padding: EdgeInsets.only(top: 10.w, bottom: 35.w),
  153. child: Text(
  154. "00:00:00",
  155. style: TextStyle(
  156. color: ColorName.white,
  157. fontSize: 16.w,
  158. ),
  159. ),
  160. )
  161. ],
  162. )
  163. ],
  164. );
  165. }
  166. Widget _buildBottomGradient() {
  167. return Container(
  168. height: 0.38.sh,
  169. decoration: BoxDecoration(
  170. gradient: LinearGradient(
  171. begin: Alignment.topCenter,
  172. end: Alignment.bottomCenter,
  173. colors: [
  174. "#006177F2".color,
  175. "#806177F2".color,
  176. ],
  177. ),
  178. ),
  179. );
  180. }
  181. }