view.dart 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import '../../../common/style/index.dart';
  4. import '../../../common/widgets/index.dart';
  5. import 'index.dart';
  6. import 'widgets/widgets.dart';
  7. class ImPage extends GetView<ImController> {
  8. const ImPage({Key? key}) : super(key: key);
  9. // 主视图
  10. Widget _buildView() {
  11. return const ConversationListWidget();
  12. }
  13. @override
  14. Widget build(BuildContext context) {
  15. return GetBuilder<ImController>(
  16. builder: (_) {
  17. return Scaffold(
  18. appBar: AppBar(
  19. title: Text('home_tab_im'.tr),
  20. actions: [
  21. TextButton(
  22. onPressed: () => controller.startSingleChat(),
  23. child: Text('im_action_single'.tr,
  24. style: AppTheme.whitePrimaryTextStyle)),
  25. TextButton(
  26. onPressed: () => controller.startGroupChat(),
  27. child: Text('im_action_group'.tr,
  28. style: AppTheme.whitePrimaryTextStyle)),
  29. ],
  30. ),
  31. body: SafeArea(
  32. child: Container(
  33. color: Theme.of(context).scaffoldBackgroundColor,
  34. child: _buildView(),
  35. )),
  36. floatingActionButton: Obx(() => Visibility(
  37. visible: controller.state.showSpeechAssistant,
  38. child: FloatingActionButton(
  39. onPressed: () => controller.startSpeechAssistant(),
  40. backgroundColor: Theme.of(context).colorScheme.primary,
  41. child: const AssetsImageView('icon_zhinengyuyin.png', width: 48, height: 48)
  42. // const Icon(
  43. // Icons.record_voice_over,
  44. // color: Colors.white,
  45. // size: 36,
  46. // )
  47. ),
  48. )),
  49. );
  50. },
  51. );
  52. }
  53. }