Browse Source

优化新手指引

weicu
tanlongsheng 1 year ago
parent
commit
eeeca0e993
  1. 39
      lib/core/widgets/intro_overlay_builder.dart
  2. 6
      lib/modules/agent/views/agent_view.dart
  3. 2
      lib/modules/home/views/home_view.dart

39
lib/core/widgets/intro_overlay_builder.dart

@ -44,7 +44,7 @@ class IntroOverlayBuilder {
child: Lottie.asset('assets/lottie/intro_foriday.json'), child: Lottie.asset('assets/lottie/intro_foriday.json'),
), ),
Padding( Padding(
padding: EdgeInsets.only(bottom: 20.w), padding: EdgeInsets.only(bottom: 10.w),
child: Text( child: Text(
isWakeup ? '我在呢~' : title, isWakeup ? '我在呢~' : title,
style: TextStyle( style: TextStyle(
@ -74,7 +74,32 @@ class IntroOverlayBuilder {
Function? onNext, Function? onNext,
Function? onFinish, Function? onFinish,
}) { }) {
return Column( double height =
(params.offset?.dy ?? 0) - ScreenUtil().statusBarHeight - 20.w;
double left = params.offset?.dx ?? 0;
double right = 1.sw - left - params.size.width;
return SizedBox(
height: height,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: EdgeInsetsGeometry.all(12.w),
alignment: Alignment.centerRight,
child: _button(
'跳过',
() {
params.onFinish();
},
isSkip: true,
),
),
Padding(
padding: EdgeInsets.only(
left: alignment ? left : 12.w,
right: alignment ? 12.w : right,
),
child: Column(
crossAxisAlignment: crossAxisAlignment:
alignment ? CrossAxisAlignment.start : CrossAxisAlignment.end, alignment ? CrossAxisAlignment.start : CrossAxisAlignment.end,
children: [ children: [
@ -107,17 +132,13 @@ class IntroOverlayBuilder {
onFinish(); onFinish();
}, },
), ),
if (onNext != null || onFinish != null) const Spacer(), ],
_button(
'跳过',
() {
params.onFinish();
},
isSkip: true,
), ),
], ],
), ),
),
], ],
),
); );
} }

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

@ -242,6 +242,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
? IntroStepBuilder( ? IntroStepBuilder(
group: 'ai', group: 'ai',
order: 4, order: 4,
getOverlayPosition:
IntroOverlayBuilder.overlayPosition,
overlayBuilder: (params) { overlayBuilder: (params) {
return IntroOverlayBuilder.aiBuilder( return IntroOverlayBuilder.aiBuilder(
params, params,
@ -504,6 +506,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
return IntroStepBuilder( return IntroStepBuilder(
group: 'ai', group: 'ai',
order: 1, order: 1,
getOverlayPosition:
IntroOverlayBuilder.overlayPosition,
overlayBuilder: (params) { overlayBuilder: (params) {
return IntroOverlayBuilder.aiBuilder( return IntroOverlayBuilder.aiBuilder(
params, params,
@ -751,6 +755,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
widgetParams!.onNext!(); widgetParams!.onNext!();
controller.sendMessage(); controller.sendMessage();
}, },
getOverlayPosition:
IntroOverlayBuilder.overlayPosition,
overlayBuilder: (params) { overlayBuilder: (params) {
widgetParams = params; widgetParams = params;
return IntroOverlayBuilder.aiBuilder( return IntroOverlayBuilder.aiBuilder(

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

@ -101,6 +101,7 @@ class HomeView extends GetView<HomeController> {
onWidgetLoad: () { onWidgetLoad: () {
controller.noviceGuideService.startHomeGuide(); controller.noviceGuideService.startHomeGuide();
}, },
getOverlayPosition: IntroOverlayBuilder.overlayPosition,
overlayBuilder: (params) { overlayBuilder: (params) {
return IntroOverlayBuilder.aiBuilder( return IntroOverlayBuilder.aiBuilder(
params, params,
@ -743,6 +744,7 @@ class HomeView extends GetView<HomeController> {
Intro.of(Get.context!).dispose(); Intro.of(Get.context!).dispose();
controller.exploreAIFeatures(); controller.exploreAIFeatures();
}, },
getOverlayPosition: IntroOverlayBuilder.overlayPosition,
overlayBuilder: (params) { overlayBuilder: (params) {
return IntroOverlayBuilder.aiBuilder( return IntroOverlayBuilder.aiBuilder(
params, params,

Loading…
Cancel
Save