Skip to content

Commit

Permalink
Merge pull request #83 from mylxsw/feature/video
Browse files Browse the repository at this point in the history
Feature/video
  • Loading branch information
mylxsw authored Jan 4, 2024
2 parents ee31cbc + f4e8463 commit aec32ea
Show file tree
Hide file tree
Showing 34 changed files with 1,413 additions and 82 deletions.
Binary file added assets/play.png
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 assets/text-to-video.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 44 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,21 @@ PODS:
- Mantle (2.2.0):
- Mantle/extobjc (= 2.2.0)
- Mantle/extobjc (2.2.0)
- media_kit_libs_ios_video (1.0.4):
- Flutter
- media_kit_native_event_loop (1.0.0):
- Flutter
- media_kit_video (0.0.1):
- Flutter
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- record (0.0.1):
- Flutter
- screen_brightness_ios (0.1.0):
- Flutter
- SDWebImage (5.15.5):
- SDWebImage/Core (= 5.15.5)
- SDWebImage/Core (5.15.5)
Expand All @@ -100,6 +110,10 @@ PODS:
- Flutter
- url_launcher_ios (0.0.1):
- Flutter
- volume_controller (0.0.1):
- Flutter
- wakelock_plus (0.0.1):
- Flutter
- WechatOpenSDK-XCFramework (2.0.2)

DEPENDENCIES:
Expand All @@ -115,14 +129,21 @@ DEPENDENCIES:
- fluwx (from `.symlinks/plugins/fluwx/ios`)
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
- in_app_purchase_storekit (from `.symlinks/plugins/in_app_purchase_storekit/darwin`)
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
- media_kit_video (from `.symlinks/plugins/media_kit_video/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- record (from `.symlinks/plugins/record/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- tobias (from `.symlinks/plugins/tobias/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- volume_controller (from `.symlinks/plugins/volume_controller/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -161,10 +182,20 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_gallery_saver/ios"
in_app_purchase_storekit:
:path: ".symlinks/plugins/in_app_purchase_storekit/darwin"
media_kit_libs_ios_video:
:path: ".symlinks/plugins/media_kit_libs_ios_video/ios"
media_kit_native_event_loop:
:path: ".symlinks/plugins/media_kit_native_event_loop/ios"
media_kit_video:
:path: ".symlinks/plugins/media_kit_video/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
record:
:path: ".symlinks/plugins/record/ios"
screen_brightness_ios:
:path: ".symlinks/plugins/screen_brightness_ios/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
Expand All @@ -177,6 +208,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/tobias/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
volume_controller:
:path: ".symlinks/plugins/volume_controller/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"

SPEC CHECKSUMS:
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
Expand All @@ -196,19 +231,26 @@ SPEC CHECKSUMS:
in_app_purchase_storekit: 4fb7ee9e824b1f09107fbfbbce8c4b276366dc43
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
record: cae05d8dd3cdb1dea3511b20e5a5811a1ae00d0d
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
SDWebImageWebPCoder: 295a6573c512f54ad2dd58098e64e17dcf008499
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

COCOAPODS: 1.12.1
COCOAPODS: 1.14.3
1 change: 1 addition & 0 deletions lib/bloc/creative_island_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class CreativeIslandBloc
});

on<CreativeIslandHistoryItemLoadEvent>((event, emit) async {
emit(CreativeIslandHistoryItemLoading());
emit(CreativeIslandHistoryItemLoaded(
item: await APIServer().creativeHistoryItem(
hisId: event.itemId,
Expand Down
2 changes: 2 additions & 0 deletions lib/bloc/creative_island_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class CreativeIslandListLoaded extends CreativeIslandState {
get error => _error;
}

class CreativeIslandHistoryItemLoading extends CreativeIslandState {}

class CreativeIslandHistoryItemLoaded extends CreativeIslandState {
final Object? error;
final CreativeItemInServer? item;
Expand Down
2 changes: 1 addition & 1 deletion lib/helper/constant.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

// 客户端应用版本号
const clientVersion = '1.0.10';
const clientVersion = '1.0.11';
// 本地数据库版本号
const databaseVersion = 26;

Expand Down
61 changes: 52 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ import 'page/component/theme/theme.dart';
import 'package:sizer/sizer.dart';
import 'package:askaide/helper/http.dart' as httpx;
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:media_kit/media_kit.dart';

import 'package:askaide/helper/env.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();
httpx.HttpClient.init();

// FlutterError.onError = (FlutterErrorDetails details) {
Expand Down Expand Up @@ -232,7 +234,6 @@ class MyApp extends StatefulWidget {

// Bloc
late final RoomBloc chatRoomBloc;
late final CreativeIslandBloc creativeIslandBloc;
late final GalleryBloc galleryBloc;
late final AccountBloc accountBloc;
late final VersionBloc versionBloc;
Expand All @@ -254,7 +255,6 @@ class MyApp extends StatefulWidget {
}) {
chatRoomBloc =
RoomBloc(chatMsgRepo: chatMsgRepo, stateManager: messageStateManager);
creativeIslandBloc = CreativeIslandBloc(creativeIslandRepo);
accountBloc = AccountBloc(settingRepo);
versionBloc = VersionBloc();
galleryBloc = GalleryBloc();
Expand Down Expand Up @@ -533,7 +533,9 @@ class MyApp extends StatefulWidget {
MultiBlocProvider(
providers: [
BlocProvider.value(value: accountBloc),
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: UserCenterScreen(
settings: context.read<SettingRepository>()),
Expand Down Expand Up @@ -583,7 +585,9 @@ class MyApp extends StatefulWidget {
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: DrawListScreen(
setting: settingRepo,
Expand All @@ -598,13 +602,17 @@ class MyApp extends StatefulWidget {
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: ImageEditDirectScreen(
setting: settingRepo,
title: AppLocale.superResolution.getString(context),
apiEndpoint: 'upscale',
note: state.queryParameters['note'],
initWaitDuration: 15,
initImage: state.queryParameters['init_image'],
),
),
),
Expand All @@ -616,13 +624,39 @@ class MyApp extends StatefulWidget {
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: ImageEditDirectScreen(
setting: settingRepo,
title: AppLocale.colorizeImage.getString(context),
apiEndpoint: 'colorize',
note: state.queryParameters['note'],
initWaitDuration: 15,
initImage: state.queryParameters['init_image'],
),
),
),
),
GoRoute(
name: 'creative-video',
path: '/creative-draw/create-video',
parentNavigatorKey: _shellNavigatorKey,
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: ImageEditDirectScreen(
setting: settingRepo,
title: '图生视频',
apiEndpoint: 'image-to-video',
note: state.queryParameters['note'],
initWaitDuration: 60,
initImage: state.queryParameters['init_image'],
),
),
),
Expand Down Expand Up @@ -659,6 +693,8 @@ class MyApp extends StatefulWidget {
),
mode: state.queryParameters['mode']!,
id: state.queryParameters['id']!,
note: state.queryParameters['note'],
initImage: state.queryParameters['init_image'],
),
),
),
Expand All @@ -679,6 +715,7 @@ class MyApp extends StatefulWidget {
),
type: state.queryParameters['type']!,
id: state.queryParameters['id']!,
note: state.queryParameters['note'],
),
),
),
Expand All @@ -691,7 +728,9 @@ class MyApp extends StatefulWidget {
return transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: MyCreationScreen(
setting: settingRepo,
Expand All @@ -709,7 +748,9 @@ class MyApp extends StatefulWidget {
return transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: CreativeModelScreen(setting: settingRepo),
),
Expand All @@ -728,7 +769,9 @@ class MyApp extends StatefulWidget {
return transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: MyCreationItemPage(
setting: settingRepo,
Expand Down
3 changes: 3 additions & 0 deletions lib/page/component/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Button extends StatelessWidget {

final Color? backgroundColor;
final Color? color;
final Widget? icon;

const Button({
super.key,
Expand All @@ -16,6 +17,7 @@ class Button extends StatelessWidget {
this.size = const ButtonSize.small(),
this.backgroundColor,
this.color,
this.icon,
});

@override
Expand All @@ -28,6 +30,7 @@ class Button extends StatelessWidget {
onPressed: onPressed,
backgroundColor: backgroundColor,
color: color,
icon: icon,
);
}
}
Expand Down
6 changes: 5 additions & 1 deletion lib/page/component/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ showCustomBeautyDialog(
showBeautyDialog(
BuildContext context, {
required QuickAlertType type,
required String text,
String? text,
String? title,
String? customAsset,
Widget? widget,
String confirmBtnText = '确定',
String? cancelBtnText,
Function()? onConfirmBtnTap,
Expand All @@ -133,6 +135,8 @@ showBeautyDialog(
context: context,
type: type,
text: text,
customAsset: customAsset,
widget: widget,
width: MediaQuery.of(context).size.width > 600 ? 400 : null,
barrierDismissible: barrierDismissible,
showCancelBtn: showCancelBtn,
Expand Down
10 changes: 9 additions & 1 deletion lib/page/component/image.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import 'dart:io';

import 'package:askaide/helper/image.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

ImageProvider resolveImageProvider(String imageUrl) {
ImageProvider resolveImageProvider(
String imageUrl, {
bool useThumbnail = true,
}) {
if (imageUrl.startsWith('http://') || imageUrl.startsWith('https://')) {
if (useThumbnail) {
imageUrl = imageURL(imageUrl, 'thumb');
}

return CachedNetworkImageProviderEnhanced(imageUrl);
}

Expand Down
Loading

0 comments on commit aec32ea

Please sign in to comment.