Browse Source

修改引导页

newdev_shunjiawei
tanlongsheng 1 year ago
parent
commit
45ea739d02
  1. 5
      lib/core/widgets/intro_overlay_builder.dart
  2. 5
      lib/data/services/novice_guide_service.dart
  3. 1
      lib/modules/agent/views/agent_view.dart
  4. 35
      lib/modules/home/views/home_view.dart

5
lib/core/widgets/intro_overlay_builder.dart

@ -6,6 +6,7 @@ class IntroOverlayBuilder {
static Widget aiBuilder(
StepWidgetParams params,
String text, {
String buttonText = '下一步',
bool alignment = true,
Function? onNext,
Function? onFinish,
@ -29,7 +30,7 @@ class IntroOverlayBuilder {
children: [
if (onNext != null)
_button(
'确定输入',
buttonText,
() {
params.onNext!();
onNext();
@ -37,7 +38,7 @@ class IntroOverlayBuilder {
),
if (onFinish != null)
_button(
'下一步',
buttonText,
() {
params.onFinish();
onFinish();

5
lib/data/services/novice_guide_service.dart

@ -6,7 +6,7 @@ class NoviceGuideService extends GetxService {
final GetStorage _storage = GetStorage();
bool isHomeGuide = true;
bool isAIGuide = false;
bool isAIGuide = true;
int aiStep = 0;
@ -56,8 +56,9 @@ class NoviceGuideService extends GetxService {
// isAIGuide = _storage.read('ai_guide') ?? false;
}
void startHomeGuide() {
void startHomeGuide() async {
if (!isHomeGuide) {
await Future.delayed(const Duration(milliseconds: 200));
isHomeGuide = true;
_storage.write('home_guide', true);
Intro.of(Get.context!).start(group: 'home');

1
lib/modules/agent/views/agent_view.dart

@ -432,6 +432,7 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
.aiStepsList[
controller.noviceGuideService
.aiStep]['start'],
buttonText: '确定输入',
onNext: () {
controller.textController.text =
controller.noviceGuideService

35
lib/modules/home/views/home_view.dart

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_intro/flutter_intro.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../core/widgets/intro_overlay_builder.dart';
import '../controllers/home_controller.dart';
import '../../../routes/app_routes.dart';
import '../../../core/widgets/common_bottom_nav.dart';
@ -84,31 +85,46 @@ class HomeView extends GetView<HomeController> {
_buildAppBar(isDarkMode),
// 顶部图片
_buildEarbudsImage(),
SizedBox(height: 20.h),
// 设备状态卡片
IntroStepBuilder(
group: 'home',
order: 1,
text: '欢迎使用Voitrans!首先,让我们唤醒你的专属 AI—— 小言',
onWidgetLoad: () {
controller.noviceGuideService.startHomeGuide();
},
overlayBuilder: (params) {
return IntroOverlayBuilder.aiBuilder(
params,
'欢迎使用Voitrans!首先,让我们唤醒你的专属 AI—— 小言',
onNext: () {},
);
},
builder: (BuildContext context, GlobalKey key) => SizedBox(
key: key,
child: _buildEarbudsImage(),
child: _buildDeviceStatusCard(isDarkMode),
),
),
SizedBox(height: 20.h),
// 设备状态卡片
IntroStepBuilder(
group: 'home',
order: 2,
text: '对着麦克风说“小言小言”',
overlayBuilder: (params) {
return IntroOverlayBuilder.aiBuilder(
params,
'对着麦克风说“小言小言”',
onNext: () {},
);
},
builder: (BuildContext context, GlobalKey key) => SizedBox(
key: key,
child: _buildDeviceStatusCard(isDarkMode),
),
),
SizedBox(height: 20.h),
// 热门AI体验
_buildSectionTitle(isDarkMode),
@ -645,11 +661,16 @@ class HomeView extends GetView<HomeController> {
child: IntroStepBuilder(
group: 'home',
order: 3,
text: '太棒了!你已成功唤醒小言,接下来试试让它帮你做件事吧',
onHighlightWidgetTap: () {
Intro.of(Get.context!).dispose();
controller.exploreAIFeatures();
},
overlayBuilder: (params) {
return IntroOverlayBuilder.aiBuilder(
params,
'太棒了!你已成功唤醒小言,接下来试试让它帮你做件事吧',
);
},
builder: (BuildContext context, GlobalKey key) => _buildFeatureCard(
key: key,
title: 'aiAssistant'.tr, // AI全能助手

Loading…
Cancel
Save