Skip to content

Commit

Permalink
added rive in welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
drriguz committed Mar 18, 2024
1 parent 645c93b commit edb7437
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 135 deletions.
Binary file added editing/assets/cat.riv
Binary file not shown.
Binary file added editing/assets/cat_following_the_mouse.riv
Binary file not shown.
Binary file added editing/assets/hippo.riv
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions editing/assets/images/receptionist-outline-913f1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editing/assets/vehicles.riv
Binary file not shown.
3 changes: 2 additions & 1 deletion editing/lib/ui/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:drift/drift.dart' as drift;
import 'package:editing/store/note_list.dart';
import 'package:editing/ui/pages/activity.dart';
import 'package:editing/ui/pages/assistant.dart';
import 'package:editing/ui/pages/welcome.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../database/database.dart';
Expand Down Expand Up @@ -150,7 +151,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
),
],
),
body: ActivityPage(),
body: WelcomePage(),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
Expand Down
69 changes: 69 additions & 0 deletions editing/lib/ui/pages/welcome.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:rive/rive.dart';

import '../widgets/activity.dart';
import '../widgets/task.dart';

class WelcomePage extends StatefulWidget {
WelcomePage({super.key});

@override
State<WelcomePage> createState() => _WelcomePageState();
}

class _WelcomePageState extends State<WelcomePage> {
SMITrigger? _trigger;

void _hitBite() => _trigger?.fire();

late StateMachineController _controller;

void _onRiveInit(Artboard artboard) {
var ctrl = StateMachineController.fromArtboard(artboard, 'State Machine 1')
as StateMachineController;
ctrl.isActive = true;
artboard.addController(ctrl);
_trigger = ctrl.findInput<bool>('bite') as SMITrigger;
setState(() {
_controller = ctrl;
});
}

@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children: [
Text(
"Welcome, my lord! Today is 25th, May. You have 2 pending tasks to complete.",
style: TextStyle(fontSize: 16),
),
SizedBox(
height: 200,
width: 400,
child: GestureDetector(
child: RiveAnimation.asset(
'assets/hippo.riv',
fit: BoxFit.cover,
onInit: _onRiveInit,
),
onTap: _hitBite,
),
),
TextField(
decoration: const InputDecoration(
hintText: "Ask me anything",
suffixIcon: Icon(
Icons.send_outlined,
color: Colors.indigo,
),
),
),
],
),
);
}
}
2 changes: 2 additions & 0 deletions editing/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import FlutterMacOS
import Foundation

import path_provider_foundation
import rive_common
import sqlcipher_flutter_libs

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin"))
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
}
Loading

0 comments on commit edb7437

Please sign in to comment.