我希望我的底部工作表保留在屏幕上,直到我从代码中关闭它。通常可以通过按后退按钮(设备或应用程序栏)或什至仅通过向下手势来关闭底部工作表。我怎样才能禁用它?
_scaffoldKey.currentState
.showBottomSheet<Null>((BuildContext context) {
final ThemeData themeData = Theme.of(context);
return new ControlBottom(
songName: songName,
url: url,
play: play,
pause: pause,
state: test,
themeData: themeData,
);
}).closed.whenComplete((){
});
Run Code Online (Sandbox Code Playgroud)
控制按钮是一个不同的小部件。
我正在Google的Flutter中使用Firebase Auth和Google登录。我可以登录,但是当我关闭该应用程序(杀死它)时,我必须再次重新注册。那么,有没有一种方法可以坚持用户身份验证,直到用户明确注销为止?这是我的认证班
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
class Auth {
FirebaseAuth _firebaseAuth;
FirebaseUser _user;
Auth() {
this._firebaseAuth = FirebaseAuth.instance;
}
Future<bool> isLoggedIn() async {
this._user = await _firebaseAuth.currentUser();
if (this._user == null) {
return false;
}
return true;
}
Future<bool> authenticateWithGoogle() async {
final googleSignIn = GoogleSignIn();
final GoogleSignInAccount googleUser = await googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
this._user = await _firebaseAuth.signInWithGoogle(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
if (this._user == null) {
return false;
}
return true;
// do something …Run Code Online (Sandbox Code Playgroud) 我想要一个 UUID 字段作为 Postgres 表中的主要字段,但出现以下错误:
error[E0277]: the trait bound `uuid::Uuid: diesel::Expression` is not satisfied
--> database/src/models.rs:3:35
|
3 | #[derive(Debug, Clone, Queryable, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `uuid::Uuid`
|
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::sql_types::Uuid>` for `uuid::Uuid`
Run Code Online (Sandbox Code Playgroud)
有一些关于带有柴油的 UUID 的较旧的问题,但没有一个是可插入的,我在其中遇到了具体的错误。我正在使用带有actix web 的柴油。
这是我的模型:
use crate::schema::users;
#[derive(Debug, Clone, Queryable, Insertable)]
#[table_name="users"]
pub struct User {
pub id: uuid::Uuid,
pub phone: String,
pub name: String,
pub password: String,
}
Run Code Online (Sandbox Code Playgroud)
还有我的表架构
table! …Run Code Online (Sandbox Code Playgroud) 我正在尝试在使用 exoplayer 的播放器中设置通知图标。我有一个播放列表,正在使用 concatenatingMediaSource。我有每首歌的专辑封面网址,但我不知道如何将其设置为通知图标。我阅读了一些建议使用 AsyncTask 并在 PostExecute() 上创建通知的答案,但我不知道如何在 exoplayer playerNotificationManager 中执行操作。这是我的音频服务类:-
class AudioPlayerService: Service() {
private var player: SimpleExoPlayer? = null
private var playerNotificationManager: PlayerNotificationManager? = null
private var mediaSession: MediaSessionCompat? = null
private var mediaSessionConnector: MediaSessionConnector? = null
private var songList: ArrayList<MetaData>? = null
private var context: Context? = null
override fun onCreate() {
super.onCreate()
context = this
val descriptionAdapter = object : PlayerNotificationManager.MediaDescriptionAdapter {
override fun getCurrentContentTitle(player: Player?): String {
return songList!![player!!.currentWindowIndex].name
}
override fun getCurrentContentText(player: Player?): String? …Run Code Online (Sandbox Code Playgroud) flutter ×3
actix-web ×1
android ×1
bottom-sheet ×1
exoplayer ×1
fastapi ×1
firebase ×1
mongodb ×1
mongoengine ×1
motorengine ×1
postgresql ×1
rust ×1
rust-diesel ×1