小编BLB*_*BLB的帖子

升高按钮高度不增加

由于“凸起”按钮已被弃用,我用“凸起”按钮代替。但我无法增加升高按钮的高度。

class ZuzuButton extends StatelessWidget {
final Function onTapped;
final String name;
final double height;
final TextStyle textStyle;
final double radius;
final List<BoxShadow> shadow;
final Color color;
final bool enable;
ZuzuButton({this.onTapped,@required this.name,
  this.height,this.textStyle,this.radius,this.shadow,this.color,this.enable=true});
@override
Widget build(BuildContext context) {
  return Container(
    height: height==0?48.0:height,
    decoration: new BoxDecoration(
      borderRadius: BorderRadius.circular(radius!=null?radius:30.0),
      border: enable? Border.all(
        width: color!=null?0.0:1.0,
        color: color!=null?color:Color(0x407F16F0),
      ):null,
      boxShadow: enable?(shadow==null?[
        BoxShadow(
          color: Color(0x407F16F0),
          offset: Offset(0.0, 8.0),
          spreadRadius: 0,
          blurRadius: 20,
        ),
      ]:shadow):null,
    ),
    child: ElevatedButton(
      child: Container(
        child: Center(
          child: Text(name,style: textStyle!=null?textStyle:null,),
        ), …
Run Code Online (Sandbox Code Playgroud)

height button dart flutter

15
推荐指数
3
解决办法
3万
查看次数

flutter_markdown 多个换行符不起作用

我正在尝试flutter_markdown包来标记一些内容。但对于多个换行符,它无法正常工作。

 String exampleData="\n\nLine 1. \n\nLine2.\n\n\n\n### Heading \n\nLine3";
 Markdown(data: exampleData,)
Run Code Online (Sandbox Code Playgroud)

输出是在此输入图像描述

我尝试使用换行符“<br />”,但没有成功

 String exampleData="Line 1. \n\nLine2. <br /> <br /> \n\n### Heading \n\nLine3";
Run Code Online (Sandbox Code Playgroud)

输出是在此输入图像描述

有人可以帮我解决这个换行符或任何替代包吗?

markdown dart flutter

7
推荐指数
2
解决办法
3804
查看次数

Flutter firebase 消息传递中的双重通知

最近我升级到 firebase_messaging: ^10.0.0 当应用程序未运行时,如果收到通知,它会显示两次。我收到后在代码中修改了通知数据并显示了它。即使如此,我也可以看到已修改和未修改的通知。我不知道该通知在哪里触发。但是当应用程序运行时,它仅显示一次通知(工作正常)。这是我的代码

/*main.dart*/
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  // If you're going to use other Firebase services in the background, such as Firestore,
  // make sure you call `initializeApp` before using other Firebase services.
  //await Firebase.initializeApp();

  // await HomePageState.handleMessage(message);
  String title="${message.notification!.title}";
  String body="${message.notification!.body}";

  _flutterLocalNotificationsPlugin.show(0, title, body, platformChannelSpecifics, payload: jsonEncode(message.data));

  AppDatabase database= await $FloorAppDatabase.databaseBuilder(Constants.dataBaseName).addMigrations([migration1to2]).build();
  if(!title.toLowerCase().contains("cancelled")){
    var date=DateFormat("dd-MMM-yyyy hh:mm aa").format(DateTime.now());
    NotificationModel notification=NotificationModel(title: title,message: body,read: 0,date: date);
    await database.notificationDao.insertNotification(notification);
  }

  print("Handling a background message: ${message.messageId}");
}
Future<void> main() async {
  //this …
Run Code Online (Sandbox Code Playgroud)

android firebase flutter firebase-cloud-messaging

4
推荐指数
1
解决办法
8942
查看次数

在行内颤动展开列

我正在尝试创建这个设计。 在此输入图像描述。我的代码

Row(
                  mainAxisSize: MainAxisSize.max,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      "${DateFormat("hh:mm aa").format(DateTime.parse(requestDetails.goTime))}",
                      style: TextStyle(fontSize: 12),
                    ),
                    Column(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      mainAxisSize: MainAxisSize.max,
                      children: <Widget>[
                        Container(
                          margin: EdgeInsets.only(top: 3),
                          width: 8,
                          height: 8,
                          decoration: BoxDecoration(
                              color: Colors.green,
                              borderRadius: BorderRadius.circular(15.0)),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 3),
                          width: 4,
                          height: 4,
                          decoration: BoxDecoration(
                              color: Colors.grey,
                              borderRadius: BorderRadius.circular(15.0)),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 3),
                          width: 4,
                          height: 4,
                          decoration: BoxDecoration(
                              color: Colors.grey,
                              borderRadius: BorderRadius.circular(15.0)),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 3),
                          width: 4,
                          height: 4,
                          decoration: BoxDecoration(
                              color: Colors.grey, …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

3
推荐指数
1
解决办法
8686
查看次数

参数类型 'ModalRoute&lt;Object?&gt;?' 不能分配给参数类型“PageRoute&lt;dynamic&gt;”

最近我正在迁移到空安全。更新了 firebase_analytics:^8.0.2。

现在面临 this.observer.subscribe(this, ModalRoute.of(context)); 的问题。有人可以帮助什么通过第二个参数。

class _BookedClassDetailsPageState extends 
State<BookedClassDetailsPage> with SingleTickerProviderStateMixin, RouteAware{

late FirebaseAnalyticsObserver observer;

@override
void initState() {
 super.initState();
 observer=widget.repository.analyticsService.getAnalyticsObserver();
 observer.analytics.setCurrentScreen(
     screenName: 'Booked Class Page',
     screenClassOverride: 'BookedClassPage'
 );

}

@override
void didChangeDependencies() {
  super.didChangeDependencies();
  observer.subscribe(this, ModalRoute.of(context));
}
 @override
 void dispose() {
    observer.unsubscribe(this);
    super.dispose();
 }
}
Run Code Online (Sandbox Code Playgroud)

flutter firebase-analytics

3
推荐指数
1
解决办法
392
查看次数

从 Firestore Flutter 中读取子集合

如何从 flutter firestore 读取子集合。我正在使用 cloud_firestore。我成功地将数据添加到 firestore 但无法检索它(尝试过但失败了)。

    FirebaseUser user=await _firebaseAuth.currentUser();
    uid=user.uid;
    return user.uid;
  }
  Future addSpend(Spend spend) {
    String date=DateFormat('MM-yyyy').format(spend.date);
    print("BLB DB $date");
    return Firestore.instance.runTransaction((Transaction transactionHandler) {
      return Firestore.instance
          .collection("Spends")
          .document(uid).collection(date).document()
          .setData(spend.toJson());
    });
  }
Run Code Online (Sandbox Code Playgroud)

我试图将所有子集合读入对象列表。但是失败了。

//    QuerySnapshot querySnapshot = await Firestore.instance.collection("Spends").document(Repository.uid).collection("10-2019").getDocuments();
//    print("BLB ${querySnapshot.documentChanges}");
//    var list = querySnapshot.documents;
//    return list;


//   List<DocumentSnapshot> templist;
//   List<Map<dynamic, dynamic>> list = new List();
//    var path=Firestore.instance.collection("Spends").document(uid).collection("10-2019");
//
//    var collectionSnapshot=await path.getDocuments();
//    print("BLB collection ${collectionSnapshot}");
//   templist = collectionSnapshot.documents;
//   print("BLB …
Run Code Online (Sandbox Code Playgroud)

collections list flutter google-cloud-firestore

2
推荐指数
2
解决办法
5911
查看次数