小编Bob*_*oby的帖子

如何在颤振中过滤列表?

我正在尝试向我的 list

这是我所做的

productTemp.sort((a, b) => b.productPrice.compareTo(a.productPrice));
        productTemp = productTemp.where((x) =>
            x.productName.toLowerCase().contains(inputText.toLowerCase()));
        productTemp = productTemp.toSet().toList();
Run Code Online (Sandbox Code Playgroud)

在这里我是如何设置的

List<ProductsModel> productTemp = [];
Run Code Online (Sandbox Code Playgroud)

那么这个

class ProductsModel {
  final String productId;
  final String productName;
  final String isNew;
  final String isHot;
  final String productImage;
  final String categoryId;
  final String productPrice;
  final String productDescription;

  ProductsModel(
      {this.productId,
      this.productName,
      this.isNew,
      this.isHot,
      this.productImage,
      this.categoryId,
      this.productPrice,
      this.productDescription});

  factory ProductsModel.fromJson(Map<String, dynamic> json) {
    return ProductsModel(
      productId: json['productId'] as String,
      productName: json['productName'] as String,
      isNew: json['isNew'] as String,
      isHot: json['isHot'] as String, …
Run Code Online (Sandbox Code Playgroud)

dart flutter

7
推荐指数
1
解决办法
1万
查看次数

如何将按钮放入 Textformfield 中?

我正在尝试创建一个内部有按钮的文本表单字段。请检查屏幕截图。

在此输入图像描述

这是我所做的

TextField(
                        decoration: InputDecoration(
                          prefixIcon: Icon(Icons.search),
                          hintText: "Search",
                          border: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(2.w),
                            borderSide: BorderSide(
                              width: 0,
                              style: BorderStyle.none,
                            ),
                          ),
                          suffixIcon: ElevatedButton(
                            child: Text("Search"),
                            onPressed: () {},
                          ),
                        ),
                      ),
Run Code Online (Sandbox Code Playgroud)

但这是我的脚本的结果

在此输入图像描述

该按钮与 Textformfield 重叠,我该如何修复它?

dart flutter

6
推荐指数
1
解决办法
2029
查看次数

How can i hit nextauth sign in with postman?

Currently i'm trying to create user authentication with NextAuth. I'm able to use it inside my webapp and there is no problem with it. But now, i'm trying to hit the sign in with postman. So i can share the login end point. Here is my [...nextauth].js

const configuration = {  
    secret: process.env.NEXTAUTH_SECRET,
    cookie: {
        secure: process.env.NODE_ENV && process.env.NODE_ENV === 'production',
    },
    session: {
        strategy: "jwt",
        maxAge: 30 * 24 * 60 * 60
    },
    providers: [
        CredentialsProvider({
            id: "credentials", …
Run Code Online (Sandbox Code Playgroud)

javascript next.js next-auth

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

如何使用块过滤列表?

所以,这是 bloc (参考https://bloclibrary.dev/#/flutterinfinitelisttutorial

class ProductBloc extends Bloc<ProductsEvent, ProductsState> {
  String categoryId, userId;
  int limit, offset, type;
  http.Client client;

  ProductBloc(
      {@required this.client,
      @required this.categoryId,
      @required this.userId,
      @required this.limit,
      @required this.offset,
      @required this.type});

  @override
  ProductsState get initialState => InitialProductsState();

  @override
  Stream<ProductsState> mapEventToState(ProductsEvent event) async* {
    final currentState = state;
    print(event);
    print(state);
    if (event is FetchProductsEvent && !_hasReachedMax(currentState)) {
      String categoryId = event.categoryId;
      try {
        if (currentState is InitialProductsState) {
          final posts = await _fetchProducts(categoryId, 0, 3);
          yield ProductsLoaded(product: posts, hasReachedMax: …
Run Code Online (Sandbox Code Playgroud)

flutter

5
推荐指数
1
解决办法
4715
查看次数

找不到“firebase_messaging/FirebaseMessagingPlugin.h”文件

我正在尝试在 ios 上运行我的 flutter 应用程序,但用户界面出现此错误

/ios/Runner/GeneratedPluginRegistrant.m:6:9: 找不到“firebase_messaging/FirebaseMessagingPlugin.h”文件

这是我的 podfile 内容

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| …
Run Code Online (Sandbox Code Playgroud)

ios swift flutter

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

对 FCM 通知 Flutter 进行分组

我正在努力实现这样的目标

在此输入图像描述

我正在使用 flutter_local_notifications: ^4.0.1+2 。这是我到目前为止所做的

        BigTextStyleInformation bigTextStyleInformation =
            BigTextStyleInformation(
          payload.notification.body,
          htmlFormatBigText: true,
          contentTitle: payload.notification.title,
          htmlFormatContentTitle: true,
          summaryText: payload.data['group_name'].toString(),
          htmlFormatSummaryText: true,
        );

        AndroidNotificationDetails androidPlatformChannelSpecifics =
            AndroidNotificationDetails(
          payload.data['group_name'].toString(),
          payload.data['group_name'].toString(),
          payload.data['group_name'].toString(),
          styleInformation: bigTextStyleInformation,
          groupKey: payload.data['group_id'].toString(),
          setAsGroupSummary: true,
          importance: Importance.high,
        );
        //
        NotificationDetails platformChannelSpecifics =
            NotificationDetails(android: androidPlatformChannelSpecifics);
        await flutterLocalNotificationsPlugin.show(
            int.parse(payload.data['chat_index']),
            payload.notification.title,
            payload.notification.body,
            platformChannelSpecifics);
Run Code Online (Sandbox Code Playgroud)

这是我发送到 fcm 服务器的内容

{
  "registration_ids": [
    "dhFLSBuAT3yYC4XoeY7oKf:APA91bGbtYTxmHhua7kewUbR1-PCHlGXyS_WP1jP-vjoLkJ_JoB69fuR8XO8hfmv-_r8VekBIkuFqhhJaHSnlKIJVRaeCAE7Mu682ffZ4MASC2O_v0QR--pQOqY3Anm7Q8liEh4Sg6f9"
  ],
  "notification": {
    "body": "Example Message",
    "title": "GROUP TEST 1",
    "icon": "@drawable/ic_stat_notification_logo",
    "sound": "mySound",
    "priority": "high",
    "show_in_foreground": true,
    "click_action": "FLUTTER_NOTIFICATION_CLICK"
  },
  "data": {
    "type": …
Run Code Online (Sandbox Code Playgroud)

flutter firebase-cloud-messaging

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

从不同的状态小部件打开抽屉菜单

我有 3 StatefulWidget、MainPage、CustomAppbar 和 ProfileCustomAppbar。在我的主页中,我像这样填充抽屉:

    Widget build(BuildContext context) {
    return MaterialApp(

      home: Scaffold(
        appBar: (currentPage == profilePage)

            ? ProfileCustomAppbar(
                height: 60,
              )
            : CustomAppbar(
                height: 60,
              ),
        endDrawer: populateDrawer(),
        body: Container(
          decoration: BoxDecoration(color: Colors.white),
          child: currentPage,
        ),

      ),
    );
  }
      populateDrawer() {
        return Theme(
          data: Theme.of(context).copyWith(
              canvasColor:
              Colors.white //This will change the drawer background to blue.
            //other styles
          ),
          child: Drawer(
            child: Column(
              children: <Widget>[
                DrawerHeader(
                  child: Center(
                    child: Image.asset("assets/images/lf_logo.png",
                        height: 100, width: 100),
                  ),
                ),
                Divider(color: Configuration.PrimaryColor),

              ],
            ), …
Run Code Online (Sandbox Code Playgroud)

dart flutter

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