-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
【flutter】【demo】【flutter】【demo】Sample Demo code structure, logic optim…
…ization
- Loading branch information
Showing
18 changed files
with
2,844 additions
and
3,190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
class WidgetSize { | ||
int width; | ||
int height; | ||
|
||
WidgetSize({required int this.width, required int this.height}); | ||
} | ||
|
||
enum BeautyType { | ||
smooth, | ||
nature, | ||
pitu, | ||
ruddy, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import 'dart:collection'; | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:tencent_trtc_cloud/trtc_cloud_def.dart'; | ||
import 'package:trtc_demo/models/data_models.dart'; | ||
import 'package:trtc_demo/models/user_model.dart'; | ||
|
||
class MeetingModel extends ChangeNotifier { | ||
/// Internal, private state of the cart. | ||
int? _meetId; | ||
bool _isTextureRendering = false; | ||
int _quality = TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT; | ||
|
||
late UserModel _userInfo; | ||
List<UserModel> _userList = []; | ||
|
||
Map<BeautyType, double> _beautyInfo = { | ||
BeautyType.smooth : 6, | ||
BeautyType.nature : 6, | ||
BeautyType.pitu : 6, | ||
BeautyType.ruddy : 0 | ||
}; | ||
|
||
void setList(list) { | ||
_userList = list; | ||
notifyListeners(); | ||
} | ||
|
||
void setUserSettings( | ||
{required int meetId, | ||
required String userId, | ||
required bool enabledCamera, | ||
required bool enabledMicrophone, | ||
required bool enableTextureRendering, | ||
int? quality = null}) { | ||
_meetId = meetId; | ||
_userInfo = UserModel(userId: userId); | ||
_userInfo.isOpenCamera = enabledCamera; | ||
_userInfo.isOpenMic = enabledMicrophone; | ||
_isTextureRendering = enableTextureRendering; | ||
_quality = quality ?? TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT; | ||
} | ||
|
||
int? getMeetId() { | ||
return _meetId; | ||
} | ||
|
||
int getQuality() { | ||
return _quality; | ||
} | ||
|
||
Map getBeautyInfo() { | ||
return _beautyInfo; | ||
} | ||
|
||
bool getTextureRenderingEnable() { | ||
return _isTextureRendering; | ||
} | ||
|
||
UserModel getUserInfo() { | ||
return _userInfo; | ||
} | ||
|
||
List<UserModel> getList() { | ||
return _userList; | ||
} | ||
|
||
void removeAll() { | ||
_userList.clear(); | ||
notifyListeners(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
|
||
import 'package:trtc_demo/models/data_models.dart'; | ||
|
||
class UserModel { | ||
String userId; | ||
String? userSig; | ||
|
||
String type = 'video'; | ||
WidgetSize size = WidgetSize(width: 0, height: 0); | ||
|
||
bool enableAudio = true; | ||
bool enableVideo = true; | ||
|
||
bool isOpenMic = true; | ||
bool isOpenCamera = false; | ||
bool isFrontCamera = true; | ||
bool isSpeak = true; | ||
bool isShowingWindow = false; | ||
int? localViewId; | ||
bool isShowBeauty = true; | ||
|
||
UserModel({required String this.userId}); | ||
} |
Oops, something went wrong.