view.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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. Navigator.pop(context);
  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. print(ScreenUtil().bottomBarHeight);
  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. textAlignVertical: TextAlignVertical.center,
  272. textInputAction: TextInputAction.search,
  273. decoration: InputDecoration(
  274. hintText: '如:房地产、金融、电子设备出口、教培',
  275. hintStyle: TextStyle(fontSize: 14, color: "#AFAFAF".toColor()),
  276. labelStyle:
  277. TextStyle(fontSize: 14, color: ColorName.primaryTextColor),
  278. contentPadding: EdgeInsets.only(left: 12),
  279. border: OutlineInputBorder(borderSide: BorderSide.none),
  280. enabled: true,
  281. ),
  282. style: TextStyle(fontSize: 14.sp),
  283. ),
  284. ),
  285. Row(
  286. children: [
  287. const Text(
  288. "岗位",
  289. style: TextStyle(
  290. color: ColorName.primaryTextColor,
  291. fontSize: 15,
  292. fontWeight: FontWeight.w500,
  293. ),
  294. ),
  295. Text(
  296. "*",
  297. style: TextStyle(
  298. color: "#F5574E".toColor(),
  299. fontSize: 15,
  300. fontWeight: FontWeight.w500,
  301. ),
  302. ),
  303. ],
  304. ),
  305. Container(
  306. margin: const EdgeInsets.only(top: 8, bottom: 18),
  307. alignment: Alignment.center,
  308. height: 44.h,
  309. decoration: BoxDecoration(
  310. borderRadius: BorderRadius.circular(8.w),
  311. border: Border.all(color: '#ECECEC'.toColor(), width: 1),
  312. ),
  313. child: TextField(
  314. maxLines: 1,
  315. textAlignVertical: TextAlignVertical.center,
  316. textInputAction: TextInputAction.search,
  317. decoration: InputDecoration(
  318. hintText: '如:行政、助理、销售、总经理、创业者',
  319. hintStyle: TextStyle(fontSize: 14, color: "#AFAFAF".toColor()),
  320. labelStyle:
  321. TextStyle(fontSize: 14, color: ColorName.primaryTextColor),
  322. contentPadding: EdgeInsets.only(left: 12),
  323. border: OutlineInputBorder(borderSide: BorderSide.none),
  324. enabled: true,
  325. ),
  326. style: TextStyle(fontSize: 14.sp),
  327. ),
  328. ),
  329. ],
  330. ),
  331. );
  332. }
  333. }