view.dart 11 KB

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