view.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. import 'package:electronic_assistant/base/base_page.dart';
  2. import 'package:electronic_assistant/module/chat/start/controller.dart';
  3. import 'package:electronic_assistant/resource/assets.gen.dart';
  4. import 'package:electronic_assistant/resource/colors.gen.dart';
  5. import 'package:electronic_assistant/utils/expand.dart';
  6. import 'package:flutter/material.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'package:get/get.dart';
  9. class ChatStartPage extends BasePage<ChatStartController> {
  10. const ChatStartPage({super.key});
  11. @override
  12. bool immersive() {
  13. return true;
  14. }
  15. @override
  16. Color backgroundColor() {
  17. return ColorName.transparent;
  18. }
  19. // 点击空白处收起键盘
  20. @override
  21. void backgroundOnTapEvent() {
  22. super.backgroundOnTapEvent();
  23. FocusScope.of(Get.context!).requestFocus(FocusNode());
  24. }
  25. @override
  26. Widget buildBody(BuildContext context) {
  27. return Container(
  28. height: ScreenUtil().screenHeight - 80.h,
  29. decoration: const BoxDecoration(
  30. borderRadius: BorderRadius.only(
  31. topLeft: Radius.circular(16),
  32. topRight: Radius.circular(16),
  33. ),
  34. color: Colors.white,
  35. ),
  36. child: Stack(
  37. children: [
  38. SizedBox(
  39. width: double.infinity,
  40. child: Assets.images.bgTalkStart.image(),
  41. ),
  42. Scaffold(
  43. // resizeToAvoidBottomInset: false,
  44. backgroundColor: Colors.transparent,
  45. appBar: AppBar(
  46. scrolledUnderElevation: 0,
  47. leading: IconButton(
  48. onPressed: () {
  49. Get.back();
  50. },
  51. icon: UnconstrainedBox(
  52. child: SizedBox(
  53. width: 28.w,
  54. height: 28.w,
  55. child: Assets.images.iconTalkStartClose.image(),
  56. ),
  57. ),
  58. ),
  59. backgroundColor: Colors.transparent,
  60. title: Text(
  61. "定制你的秘书",
  62. textAlign: TextAlign.center,
  63. style: TextStyle(
  64. fontSize: 16.w,
  65. color: ColorName.primaryTextColor,
  66. fontWeight: FontWeight.w500,
  67. ),
  68. ),
  69. ),
  70. body: SingleChildScrollView(
  71. physics: const ClampingScrollPhysics(),
  72. child: SizedBox(
  73. width: double.infinity,
  74. height: ScreenUtil().screenHeight -
  75. 80.h -
  76. AppBar().preferredSize.height,
  77. child: Column(
  78. children: [
  79. buildDescripe(),
  80. buildInputTF(),
  81. const Expanded(child: SizedBox()),
  82. GestureDetector(
  83. onTap: () {
  84. controller.onNextStep();
  85. },
  86. child: Container(
  87. margin: EdgeInsets.only(
  88. left: 16.w,
  89. right: 16.w,
  90. bottom: ScreenUtil().bottomBarHeight + 6.h),
  91. height: 48.h,
  92. width: double.infinity,
  93. alignment: Alignment.center,
  94. decoration: BoxDecoration(
  95. gradient: LinearGradient(
  96. colors: ['#6177F2'.toColor(), '#8B9DFF'.toColor()],
  97. stops: const [0, 1.0],
  98. ),
  99. borderRadius: BorderRadius.circular(8),
  100. ),
  101. child: const Text(
  102. "下一步",
  103. style: TextStyle(
  104. color: ColorName.white,
  105. fontSize: 16,
  106. fontWeight: FontWeight.w500,
  107. ),
  108. ),
  109. ),
  110. )
  111. ],
  112. ),
  113. ),
  114. ),
  115. ),
  116. ],
  117. ),
  118. );
  119. }
  120. Widget buildTopBar() {
  121. return Container(
  122. height: 28.w,
  123. margin: EdgeInsets.only(left: 16.w, top: 16.h, right: 16.w),
  124. child: Row(
  125. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  126. crossAxisAlignment: CrossAxisAlignment.center,
  127. children: [
  128. GestureDetector(
  129. child: SizedBox(
  130. width: 28.w,
  131. height: 28.w,
  132. child: Assets.images.iconTalkStartClose.image(),
  133. ),
  134. ),
  135. SizedBox(
  136. child: Text(
  137. "定制你的秘书",
  138. textAlign: TextAlign.center,
  139. style: TextStyle(
  140. fontSize: 16.w,
  141. color: ColorName.primaryTextColor,
  142. fontWeight: FontWeight.w500,
  143. ),
  144. ),
  145. ),
  146. SizedBox(
  147. width: 28.w,
  148. height: 28.w,
  149. ),
  150. ],
  151. ),
  152. );
  153. }
  154. Widget buildDescripe() {
  155. return Column(
  156. children: [
  157. Container(
  158. margin: EdgeInsets.only(top: 40.h),
  159. width: 84.w,
  160. child: Assets.images.iconTalkStartLogo.image(),
  161. ),
  162. Container(
  163. margin: EdgeInsets.only(top: 6.h),
  164. width: 328.w,
  165. height: 99.h,
  166. padding: const EdgeInsets.all(1),
  167. decoration: BoxDecoration(
  168. gradient: const LinearGradient(
  169. colors: [
  170. Color.fromRGBO(226, 165, 255, 0.14),
  171. Color.fromRGBO(99, 122, 255, 0.14)
  172. ],
  173. begin: Alignment.topCenter,
  174. end: Alignment.bottomCenter,
  175. stops: [0, 1.0],
  176. ),
  177. borderRadius: BorderRadius.only(
  178. topLeft: Radius.circular(0.w),
  179. topRight: Radius.circular(16.w),
  180. bottomLeft: Radius.circular(16.w),
  181. bottomRight: Radius.circular(16.w),
  182. ),
  183. ),
  184. child: Container(
  185. decoration: BoxDecoration(
  186. gradient: LinearGradient(
  187. colors: ['#FFF5FD'.toColor(), '#EEF9FF'.toColor()],
  188. begin: Alignment.topCenter,
  189. end: Alignment.bottomCenter,
  190. stops: const [0, 1.0],
  191. ),
  192. borderRadius: BorderRadius.only(
  193. topLeft: Radius.circular(0.w),
  194. topRight: Radius.circular(16.w),
  195. bottomLeft: Radius.circular(16.w),
  196. bottomRight: Radius.circular(16.w),
  197. ),
  198. ),
  199. child: Container(
  200. padding: const EdgeInsets.only(
  201. left: 12, top: 14, right: 12, bottom: 16),
  202. child: Column(
  203. mainAxisAlignment: MainAxisAlignment.start,
  204. crossAxisAlignment: CrossAxisAlignment.start,
  205. children: [
  206. const Text(
  207. "👋 Hi,你好呀",
  208. style: TextStyle(
  209. color: ColorName.primaryTextColor,
  210. fontSize: 17,
  211. fontWeight: FontWeight.w500,
  212. ),
  213. ),
  214. Text(
  215. "作为专属秘书,告诉小听以下信息吧~",
  216. style: TextStyle(
  217. color: ColorName.primaryTextColor.withOpacity(0.8),
  218. fontSize: 14,
  219. ),
  220. ),
  221. Text(
  222. "您填写的内容,会影响我回答的准确度哦~",
  223. style: TextStyle(
  224. color: ColorName.primaryTextColor.withOpacity(0.8),
  225. fontSize: 14,
  226. ),
  227. ),
  228. ],
  229. ),
  230. ),
  231. ),
  232. ),
  233. ],
  234. );
  235. }
  236. Widget buildInputTF() {
  237. return Container(
  238. padding: const EdgeInsets.only(left: 16, right: 16, top: 24),
  239. child: Column(
  240. children: [
  241. Row(
  242. children: [
  243. const Text(
  244. "行业",
  245. style: TextStyle(
  246. color: ColorName.primaryTextColor,
  247. fontSize: 15,
  248. fontWeight: FontWeight.w500,
  249. ),
  250. ),
  251. Text(
  252. "*",
  253. style: TextStyle(
  254. color: "#F5574E".toColor(),
  255. fontSize: 15,
  256. fontWeight: FontWeight.w500,
  257. ),
  258. ),
  259. ],
  260. ),
  261. Container(
  262. margin: const EdgeInsets.only(top: 8, bottom: 18),
  263. alignment: Alignment.center,
  264. height: 44.h,
  265. decoration: BoxDecoration(
  266. borderRadius: BorderRadius.circular(8.w),
  267. border: Border.all(color: '#ECECEC'.toColor(), width: 1),
  268. ),
  269. child: TextField(
  270. maxLines: 1,
  271. controller: controller.professionController,
  272. textAlignVertical: TextAlignVertical.center,
  273. textInputAction: TextInputAction.search,
  274. decoration: InputDecoration(
  275. hintText: '如:房地产、金融、电子设备出口、教培',
  276. hintStyle: TextStyle(fontSize: 14, color: "#AFAFAF".toColor()),
  277. labelStyle:
  278. TextStyle(fontSize: 14, color: ColorName.primaryTextColor),
  279. contentPadding: EdgeInsets.only(left: 12),
  280. border: OutlineInputBorder(borderSide: BorderSide.none),
  281. enabled: true,
  282. ),
  283. style: TextStyle(fontSize: 14.sp),
  284. ),
  285. ),
  286. Row(
  287. children: [
  288. const Text(
  289. "岗位",
  290. style: TextStyle(
  291. color: ColorName.primaryTextColor,
  292. fontSize: 15,
  293. fontWeight: FontWeight.w500,
  294. ),
  295. ),
  296. Text(
  297. "*",
  298. style: TextStyle(
  299. color: "#F5574E".toColor(),
  300. fontSize: 15,
  301. fontWeight: FontWeight.w500,
  302. ),
  303. ),
  304. ],
  305. ),
  306. Container(
  307. margin: const EdgeInsets.only(top: 8, bottom: 18),
  308. alignment: Alignment.center,
  309. height: 44.h,
  310. decoration: BoxDecoration(
  311. borderRadius: BorderRadius.circular(8.w),
  312. border: Border.all(color: '#ECECEC'.toColor(), width: 1),
  313. ),
  314. child: TextField(
  315. maxLines: 1,
  316. controller: controller.postController,
  317. textAlignVertical: TextAlignVertical.center,
  318. textInputAction: TextInputAction.search,
  319. decoration: InputDecoration(
  320. hintText: '如:行政、助理、销售、总经理、创业者',
  321. hintStyle: TextStyle(fontSize: 14, color: "#AFAFAF".toColor()),
  322. labelStyle:
  323. TextStyle(fontSize: 14, color: ColorName.primaryTextColor),
  324. contentPadding: EdgeInsets.only(left: 12),
  325. border: OutlineInputBorder(borderSide: BorderSide.none),
  326. enabled: true,
  327. ),
  328. style: TextStyle(fontSize: 14.sp),
  329. ),
  330. ),
  331. ],
  332. ),
  333. );
  334. }
  335. }