2017-11-09 4 views
0

ではありません、私はすでにこの問題は、私を悩ませてきたError: '_elements.contains(element)': is not true失敗したアサーション:ライン3927のPOS 14:「_dependents.isEmpty」:真

スタックオーバーフローの上に私が投稿の質問に関連した問題で再び戻っていますが、私は同じ問題を再現することができませんでしたが、今私は何とか再度書き直しを試みました。私は、このアサーションエラーを投げてアプリをクラッシュさせている間違っていることを誰もが把握するコードを投稿しました。

私はプログラミングに慣れていないので、どんな助けでも大歓迎です。私はコードを削除して、いくつかのバグを認識しています。しかし、主な関心事は、Failed assertion: line 3927 pos 14: '_dependents.isEmpty': is not true.Failed assertion: line 1766 pos 12: '_elements.contains(element)': is not true.

手順です。

main.dart

import 'dart:async'; 
import 'package:flutter/material.dart'; 
import 'package:flutter/rendering.dart'; 
import 'package:flutter/widgets.dart'; 
import 'package:firebase_auth/firebase_auth.dart'; 
import 'package:firebase_database/firebase_database.dart'; 
import 'package:untitled1/addnewbranch.dart'; 

void main() { 
    runApp(
    new MaterialApp(
     home: new Branches(), 
    ), 
); 
} 

class ProjectModel { 
    BranchSetUpModelData branchesModel; 
    ProjectModel(this.branchesModel); 
} 

class BranchSetUpModelData { 
    String branchName; 
    String hostelType; 
    String area; 
    String city; 
    BranchSetUpModelData(this.branchName, this.hostelType, this.area, this.city); 
} 

DatabaseReference _branchesRef; 
List<ProjectModel> projectModel = new List(); 
Map data = {}; 

List<String> mapKeys = new List(); 

DataSnapshot dataSnapshot; 

class Branches extends StatefulWidget { 
    //const BranchView({ Key key }) : super(key: key); 
    const Branches({Key key}) : super(key: key); 
    @override 
    _BranchesState createState() => new _BranchesState(); 
} 

class _BranchesState extends State<Branches> { 
    String userUid = ''; 
    String text; 
    int noOfBranches = 0; 
    int itemCount; 

    Future<Null> getUserUid() async { 
    try { 
     //FirebaseUser user = await FirebaseAuth.instance.currentUser(); 
     //userUid = user.uid; 
     //print(userUid); 
     _branchesRef = 
      FirebaseDatabase.instance.reference().child('data').child('branches'); 
     print('branchesref = $_branchesRef'); 

     if (_branchesRef != null) { 
     try { 
      _branchesRef.once().then((DataSnapshot snapShot) { 
      dataSnapshot = snapShot; 
      print(snapShot is Map); 

      print(dataSnapshot.value); 
      data = dataSnapshot.value; 
      print(data is Map); 
      print(data); 

      data.forEach((key, value) { 
       mapKeys.add(key); 
      }); 
      print('no of branches = $noOfBranches'); 
      projectModel.clear(); 
      mapKeys.forEach((value) { 
       _branchesRef.child(value).once().then((DataSnapshot b) { 
       data = b.value; 
       data.keys.forEach((k) { 
        BranchSetUpModelData x = new BranchSetUpModelData(
        b.value['branchDetails']['branchName'], 
        b.value['branchDetails']['hostelType'], 
        b.value['branchDetails']['area'], 
        b.value['branchDetails']['city'], 
       ); 
        print('details from for each loop'); 
        ProjectModel projectModelData = new ProjectModel(x); 

        projectModel.add(projectModelData); 
       }); 
       print('projectmodel length = ${projectModel.length}'); 
       }); 
      }); 
      setState(() { 
       noOfBranches = mapKeys.length; 
       itemCount = noOfBranches; 
      }); 
      print('no of branches = $noOfBranches'); 

      data.keys.forEach((k) { 
       print('inside this foreach loop'); 
       print(k); 
      }); 
      }); 
     } catch (Exception) { 
      showDialog(
       context: context, 
       child: new AlertDialog(
        content: new Text(Exception.message.toString()))); 
     } 
     } else { 
     print('user does not exist'); 
     } 
    } catch (Exception) { 
     print(Exception.toString()); 
     showDialog(
      context: context, 
      child: new AlertDialog(
      content: new Text(Exception.toString()), 
     )); 
    } 
    } 

    @override 
    void initState() { 
    super.initState(); 
    mapKeys.clear(); 
    FirebaseDatabase.instance.setPersistenceEnabled(true); 
    FirebaseDatabase.instance.setPersistenceCacheSizeBytes(10000000); 
    getUserUid(); 
    /*setState((){ 
     noOfBranches = mapKeys.length; 
    });*/ 
    print('noOfBranches in init state= $noOfBranches'); 
    } 

    @override 
    Widget build(BuildContext context) { 
    print('noof branches inside widget build = $noOfBranches'); 
    //if(noOfBranches!=0) { 
    return new MaterialApp(
     title: 'Branches', 
     theme: new ThemeData(
     primaryColor: const Color(0xFF229E9C), 
    ), 
     home: new Scaffold(
     appBar: new AppBar(
      title: const Text('Branches'), 
      backgroundColor: Colors.teal[300], 
     ), 
     floatingActionButton: new FloatingActionButton(
      heroTag: 'branchesHeroTag', 
      child: new Icon(Icons.add), 
      backgroundColor: Colors.teal[300], 
      onPressed: (() { 
      Navigator.push(
       context, 
       new MaterialPageRoute(
       builder: (_) => new AddNewBranch(), 
      ), 
      ); 
      }), 
      tooltip: 'Add Branch', 
     ), 
     body: new Container(
      child: new ListView.builder(
      padding: const EdgeInsets.only(
       left: 4.0, 
       right: 4.0, 
      ), 
      itemCount: itemCount, 
      itemBuilder: (BuildContext context, int index) { 
       if (noOfBranches != 0) { 
       // children: <Widget>[ 

       return new InkWell(
        onTap: (() { 
        /*Navigate here to a different page*/ 
        }), 
        child: new Card(
        child: new Column(
         children: <Widget>[ 
         new Container(
          //margin: const EdgeInsets.only(top:16.0), 
          padding: const EdgeInsets.only(top: 16.0), 
          child: new Row(
          children: <Widget>[ 
           new Expanded(
           child: new Row(
            children: <Widget>[ 
            new Container(
             margin: const EdgeInsets.only(
              left: 16.0, 
              right: 8.0, 
              top: 4.0, 
              bottom: 4.0), 
             child: new IconButton(
              icon: new Icon(Icons.call), 
              onPressed: (() {}))), 
            new Container(
             child: new Text(
             '80/125', 
             style: new TextStyle(
              fontSize: 18.0, 
             ), 
            ), 
            ), 
            ], 
           ), 
          ), 
           new Expanded(
           child: new Row(
            textDirection: TextDirection.rtl, 
            children: [ 
            new Container(
             margin: 
              const EdgeInsets.only(right: 16.0), 
             child: new Text(
             projectModel[index] 
              .branchesModel 
              .hostelType, 
             style: new TextStyle(
              fontSize: 18.0, 
             ), 
            ), 
            ), 
            ], 
           ), 
          ), 
          ], 
         ), 
         ), 
         new Container(
          margin: 
           const EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 4.0), 
          child: new Row(children: <Widget>[ 
          new Text(
           projectModel[index].branchesModel.branchName, 
           style: new TextStyle(
           fontSize: 24.0, 
          ), 
          ), 
          ]), 
         ), 
         new Container(
          margin: const EdgeInsets.only(
           left: 16.0, right: 16.0, bottom: 8.0), 
          child: new Row(
          children: <Widget>[ 
           new Text(projectModel[index].branchesModel.city), 
          ], 
         ), 
         ), 
         ], 
        ), 
       ), 
       ); // InkWell ends here so this has to go into ListView.builder 
       } else { 
       itemCount = 1; 

       return new Center(
        child: new Column(
//   mainAxisSize: MainAxisSize.min, 
        mainAxisAlignment: MainAxisAlignment.center, 

        children: <Widget>[ 
         new Text(
         'Setup your Hostel', 
         style: new TextStyle(
          fontSize: 24.0, 
          color: Colors.grey[400], 
          fontWeight: FontWeight.bold, 
         ), 
        ), 
         new Text(
         'Please click below + icon to Setup your Hostel', 
         style: new TextStyle(
          fontSize: 16.0, 
          color: Colors.grey[400], 
         ), 
        ), 
        ], 
       ), 
       ); 
       } 
      }, 
     ), // ListView.builder ends here. 
     ), 
    ), 
    ); 
    } 
} 

globals.dart

library my_app.globals; 
import 'package:firebase_auth/firebase_auth.dart'; 
import 'package:firebase_database/firebase_database.dart'; 

final FirebaseAuth auth = FirebaseAuth.instance; 
final DatabaseReference databaseReference = FirebaseDatabase.instance.reference(); 

addnewbranch.dart

import 'dart:async'; 
import 'package:meta/meta.dart'; 
import 'package:firebase_auth/firebase_auth.dart'; 
import 'package:flutter/material.dart'; 
import 'package:flutter/rendering.dart'; 
import 'package:flutter/widgets.dart'; 
import 'package:untitled1/main.dart'; 
import './globals.dart' as gl; 

class BranchSetupModel { 
    String branchName; 
    String hostelType; 
    String area; 
    String city; 
    BranchSetupModel(this.branchName, this.hostelType, this.area, this.city); 
} 

BranchSetupModel branchSetupModel = 
    new BranchSetupModel('', 'Hostel Type', '', ''); 

class AddNewBranch extends StatefulWidget { 
    const AddNewBranch({Key key}) : super(key: key); 

    @override 
    State<StatefulWidget> createState() { 
    return new _AddNewBranchState(); 
    } 
} 

class _AddNewBranchState extends State<AddNewBranch> { 
    String actionsString = 'Next'; 
    String userUid; 

    TextEditingController _branchNameController = new TextEditingController(); 
    TextEditingController _areaController = new TextEditingController(); 
    TextEditingController _cityController = new TextEditingController(); 

    final GlobalKey<FormState> _formKey = new GlobalKey<FormState>(); 
    final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); 
    bool _formWasEdited = false; 
    bool _autovalidate = false; 
    String dropDownvalue = 'Hostel Type'; 

    //FocusNode _branchManagerNameFocusNode = new FocusNode(); 

    String _validateName(String value) { 
    _formWasEdited = true; 
    if (value.isEmpty) return 'Name is required.'; 
    final RegExp nameExp = new RegExp(r'^[A-Za-z ]+$'); 
    if (!nameExp.hasMatch(value)) 
     return 'Please enter only alphabetical characters and spaces.'; 
    return null; 
    } 

    Future<Null> getUserUid() async { 
    try { 
     FirebaseUser user = await FirebaseAuth.instance.currentUser(); 
     userUid = user.uid; 
     print(userUid); 
    } catch (Exception) { 
     print(Exception.toString()); 
    } 
    } 

    @override 
    void initState() { 
    super.initState(); 
    getUserUid(); 
    _branchNameController = 
     new TextEditingController(text: branchSetupModel.branchName); 
    _areaController = new TextEditingController(text: branchSetupModel.area); 
    _cityController = new TextEditingController(text: branchSetupModel.city); 
    dropDownvalue = branchSetupModel.hostelType; 
    branchSetupModel = new BranchSetupModel('', 'Hostel Type', '', ''); 
    } 

    @override 
    Widget build(BuildContext context) { 
    return new MaterialApp(
     theme: new ThemeData(
     primarySwatch: Colors.teal, 
    ), 
     title: 'Branch Setup', 
     home: new Scaffold(
     appBar: new AppBar(
      title: const Text('Add New Branch'), 
      backgroundColor: Colors.teal[300], 
      leading: new IconButton(
      icon: new Icon(Icons.arrow_back), 
      onPressed: (() { 
       print('back button clicked'); 
       //to be removed and to include functionality here 
       Navigator.push(
       context, 
       new MaterialPageRoute(
        builder: (_) => new Branches(), 
       ), 
      ); 
      }), 
     ), 
      actions: <Widget>[ 
      new Center(
       child: new Column(
       mainAxisAlignment: MainAxisAlignment.center, 
       mainAxisSize: MainAxisSize.min, 
       children: <Widget>[ 
        new FlatButton(
        child: new Text(
         actionsString, 
         style: new TextStyle(
         fontSize: 20.0, 
         fontWeight: FontWeight.w500, 
         color: Colors.white, 
        ), 
        ), 
        onPressed:() { 
         print('Save button clicked'); 

         String pushKey = gl.databaseReference 
          .child('data') 
          .child('branches') 
          .push() 
          .key; 
         gl.databaseReference 
          .child('data') 
          .child('branches') 
          .child(pushKey) 
          .child('branchDetails') 
          .set({ 
         "branchName": branchSetupModel.branchName, 
         "hostelType": branchSetupModel.hostelType, 
         "area": branchSetupModel.area, 
         "city": branchSetupModel.city, 
         "pushKey": pushKey 
         }); 
         Navigator.push(
         context, 
         new MaterialPageRoute(
          builder: (_) => new Branches(), 
         ), 
        ); 
        }, 
        splashColor: const Color(0xFF229E9C), 
       ), 
       ], 
      ), 
      ), 
      ], 
     ), 
     body: new Form(
      key: _formKey, 
      child: new ListView(
      children: <Widget>[ 
       new Container(
       margin: const EdgeInsets.only(left: 16.0, right: 16.0), 
       child: new Row(
        children: <Widget>[ 
        new Text('Hostel Type'), 
        ], 
       ), 
      ), 
       new Container(
       //height: 56.0, 
       margin: const EdgeInsets.only(left: 16.0, right: 16.0), 
       child: new Column(
        children: <Widget>[ 
        new DropdownButton<String>(
         //key: _dropDownKey, 
         hint: new Text(dropDownvalue), 

         items: <String>[ 
         'Mens', 
         'Womens', 
         ].map(
         (String value) { 
          return new DropdownMenuItem<String>(
          value: value, 
          child: new Text(value), 
         ); 
         }, 
        ).toList(), 
         onChanged: (String value) { 
         setState(() { 
          dropDownvalue = value; 
          branchSetupModel.hostelType = value; 
          print(branchSetupModel.hostelType); 
         }); 
         }, 
        ), 
        ], 
       ), 
      ), 
       new Container(
       margin: const EdgeInsets.only(left: 16.0, right: 16.0), 
       child: new Row(
        children: <Widget>[ 
        new Expanded(
         child: new TextField(
         autocorrect: false, 
         decoration: new InputDecoration(
          labelText: 'Branch Name', 
         ), 
         controller: _branchNameController, 
         onChanged: (String value) { 
          branchSetupModel.branchName = 
           _branchNameController.text; 
          print(branchSetupModel.branchName); 
         }, 
         //validator: _validateName, 
        ), 
        ), 
        ], 
       ), 
      ), 
       new Container(
       margin: const EdgeInsets.only(left: 16.0, right: 16.0), 
       child: new Row(
        children: <Widget>[ 
        new Expanded(
         child: new TextField(
         decoration: new InputDecoration(
          labelText: 'Area/Location', 
         ), 
         controller: _areaController, 
         onChanged: (String value) { 
          branchSetupModel.area = value; 
          print(branchSetupModel.area); 
         }, 
         //validator: _validateName, 
        ), 
        ), 
        ], 
       ), 
      ), 
       new Container(
       margin: const EdgeInsets.only(
        left: 16.0, 
        right: 16.0, 
       ), 
       child: new Row(
        children: <Widget>[ 
        new Expanded(
         child: new TextField(
         decoration: new InputDecoration(
          labelText: 'City', 
         ), 
         controller: _cityController, 
         onChanged: (String value) { 
          branchSetupModel.city = value; 
         }, 
        ), 
        ), 
        ], 
       ), 
      ), 
      ], 
     ), 
     ), 
    ), 
    ); 
    } 
} 

pubspec.yaml

name: untitled1 
description: A new Flutter project. 

dependencies: 
    flutter: 
    sdk: flutter 
    google_sign_in: ^1.0.1 
    firebase_analytics: ^0.1.1 
    firebase_auth: ^0.3.1 
    firebase_database: ^0.1.2 
    firebase_storage: ^0.0.7 


dev_dependencies: 
    flutter_test: 
    sdk: flutter 


# For information on the generic Dart part of this file, see the 
# following page: https://www.dartlang.org/tools/pub/pubspec 

# The following section is specific to Flutter. 
flutter: 

    # The following line ensures that the Material Icons font is 
    # included with your application, so that you can use the icons in 
    # the material Icons class. 
    uses-material-design: true 

エラーを再現してお読みくださいしようとする前に、コードを実行し、私のように「真」に設定されたアクセスを書くことfirebaseアプリを統合してください。認証を追加していません。

私の知る限り、main.dartファイルにのみエラーが発生します。数回は正常に動作し、次にエラーが発生します。まず、エラーをスローアップします。RangeError (index): Invalid value: Valid value range is empty: 0このエラーはListView.builder()他の2つのアサーションエラーが発生します。

私が間違っていることを教えてもらえますか、これらのエラーがなければ同じ目標を達成するためには別の方法がありますか?

フラッタードクターコマンドから出力されます。

私の同僚の
[√] Flutter (on Microsoft Windows [Version 10.0.15063], locale en-GB, channel alpha) 
    • Flutter at C:\Users\Prayuta\flutter 
    • Framework revision e8aa40eddd (3 weeks ago), 2017-10-17 15:42:40 -0700 
    • Engine revision 7c4142808c 
    • Tools Dart version 1.25.0-dev.11.0 

[√] Android toolchain - develop for Android devices (Android SDK 27.0.0) 
    • Android SDK at C:\Users\Prayuta\AppData\Local\Android\sdk 
    • Platform android-27, build-tools 27.0.0 
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java 
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01) 

[√] Android Studio (version 3.0) 
    • Android Studio at C:\Program Files\Android\Android Studio 
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01) 

[√] IntelliJ IDEA Community Edition (version 2017.2) 
    • Flutter plugin version 18.4 
    • Dart plugin version 172.4343.25 

[√] Connected devices 
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator) 

Process finished with exit code 0. 

答えて

2

一つは、実際に私は私のListView.builderを構築してきたと私は今、エラーを見ていないです方法を変更しました。私はこれに注意を払い、この質問に答えるための新しいやり方や、何か間違いが起こったことを再び伝えます。

私は参照用に投稿したmain.dartファイルのみを変更しました。

メイン。私は、これは、 多くのおかげで自分の問題を解決するために、同じユースケースで苦労しているすべての人を助けることを願っています

import 'dart:async'; 
import 'package:flutter/material.dart'; 
import 'package:flutter/rendering.dart'; 
import 'package:flutter/widgets.dart'; 
import 'package:firebase_auth/firebase_auth.dart'; 
import 'package:firebase_database/firebase_database.dart'; 
import 'package:untitled1/addnewbranch.dart'; 

void main() { 
    runApp(
    new MaterialApp(
     home: new Branches(), 
    ), 
); 
} 

class ProjectModel { 
    BranchSetUpModelData branchesModel; 

    ProjectModel(this.branchesModel); 
} 

class BranchSetUpModelData { 
    String branchName; 
    String hostelType; 
    String area; 
    String city; 

    BranchSetUpModelData(this.branchName, this.hostelType, this.area, this.city); 
} 

DatabaseReference _branchesRef; 
List<ProjectModel> projectModel = new List(); 
Map data = {}; 

List<String> mapKeys = new List(); 

DataSnapshot dataSnapshot; 

class Branches extends StatefulWidget { 
    //const BranchView({ Key key }) : super(key: key); 
    const Branches({Key key}) : super(key: key); 

    @override 
    _BranchesState createState() => new _BranchesState(); 
} 

class _BranchesState extends State<Branches> { 
    String userUid = ''; 
    String text; 

    Future<Null> getUserUid() async { 
    try { 
     //FirebaseUser user = await FirebaseAuth.instance.currentUser(); 
     //userUid = user.uid; 
     //print(userUid); 
     _branchesRef = 
      FirebaseDatabase.instance.reference().child('data').child('branches'); 
     print('branchesref = $_branchesRef'); 

     if (_branchesRef != null) { 
     try { 
      _branchesRef.once().then((DataSnapshot snapShot) { 
      dataSnapshot = snapShot; 
      print(snapShot is Map); 

      print(dataSnapshot.value); 
      data = dataSnapshot.value; 
      print(data is Map); 
      print(data); 

      data.forEach((key, value) { 
       mapKeys.add(key); 
      }); 

      projectModel.clear(); 
      mapKeys.forEach((value) { 
       _branchesRef.child(value).once().then((DataSnapshot b) { 
       data = b.value; 
       setState(() { 
        data.keys.forEach((k) { 
        BranchSetUpModelData x = new BranchSetUpModelData(
         b.value['branchDetails']['branchName'], 
         b.value['branchDetails']['hostelType'], 
         b.value['branchDetails']['area'], 
         b.value['branchDetails']['city'], 
        ); 
        print('details from for each loop'); 
        ProjectModel projectModelData = new ProjectModel(x); 

        projectModel.add(projectModelData); 
        }); 
       }); 
       print('projectmodel length = ${projectModel.length}'); 
       }); 
      }); 

      data.keys.forEach((k) { 
       print('inside this foreach loop'); 
       print(k); 
      }); 
      }); 
     } catch (Exception) { 
      showDialog(
       context: context, 
       child: new AlertDialog(
        content: new Text(Exception.message.toString()))); 
     } 
     } else { 
     print('user does not exist'); 
     } 
    } catch (Exception) { 
     print(Exception.toString()); 
     showDialog(
      context: context, 
      child: new AlertDialog(
      content: new Text(Exception.toString()), 
     )); 
    } 
    } 

    @override 
    void initState() { 
    super.initState(); 
    mapKeys.clear(); 
    FirebaseDatabase.instance.setPersistenceEnabled(true); 
    FirebaseDatabase.instance.setPersistenceCacheSizeBytes(10000000); 
    getUserUid(); 
    /*setState((){ 
     noOfBranches = mapKeys.length; 
    });*/ 
    } 

    @override 
    Widget build(BuildContext context) { 
    //if(noOfBranches!=0) { 
    return new MaterialApp(
     title: 'Branches', 
     theme: new ThemeData(
     primaryColor: const Color(0xFF229E9C), 
    ), 
     home: new Scaffold(
     appBar: new AppBar(
      title: const Text('Branches'), 
      backgroundColor: Colors.teal[300], 
     ), 
     floatingActionButton: new FloatingActionButton(
      heroTag: 'branchesHeroTag', 
      child: new Icon(Icons.add), 
      backgroundColor: Colors.teal[300], 
      onPressed: (() { 
      Navigator.push(
       context, 
       new MaterialPageRoute(
       builder: (_) => new AddNewBranch(), 
      ), 
      ); 
      }), 
      tooltip: 'Add Branch', 
     ), 
     body: (projectModel.length == 0) 
      ? new Center(
       child: new Column(
//   mainAxisSize: MainAxisSize.min, 
        mainAxisAlignment: MainAxisAlignment.center, 

        children: <Widget>[ 
        new Text(
         'Setup your Hostel', 
         style: new TextStyle(
         fontSize: 24.0, 
         color: Colors.grey[400], 
         fontWeight: FontWeight.bold, 
        ), 
        ), 
        new Text(
         'Please click below + icon to Setup your Hostel', 
         style: new TextStyle(
         fontSize: 16.0, 
         color: Colors.grey[400], 
        ), 
        ), 
        ], 
       ), 
      ) 
      : new Container(
       child: new ListView.builder(
        padding: const EdgeInsets.only(
        left: 4.0, 
        right: 4.0, 
       ), 
        itemCount: projectModel.length, 
        itemBuilder: (BuildContext context, int index) { 
        // children: <Widget>[ 

        return new InkWell(
         onTap: (() { 
         /*Navigate here to a different page*/ 
         }), 
         child: new Card(
         child: new Column(
          children: <Widget>[ 
          new Container(
           //margin: const EdgeInsets.only(top:16.0), 
           padding: const EdgeInsets.only(top: 16.0), 
           child: new Row(
           children: <Widget>[ 
            new Expanded(
            child: new Row(
             children: <Widget>[ 
             new Container(
              margin: const EdgeInsets.only(
               left: 16.0, 
               right: 8.0, 
               top: 4.0, 
               bottom: 4.0), 
              child: new IconButton(
               icon: new Icon(Icons.call), 
               onPressed: (() {}))), 
             new Container(
              child: new Text(
              '80/125', 
              style: new TextStyle(
               fontSize: 18.0, 
              ), 
             ), 
             ), 
             ], 
            ), 
           ), 
            new Expanded(
            child: new Row(
             textDirection: TextDirection.rtl, 
             children: [ 
             new Container(
              margin: const EdgeInsets.only(
               right: 16.0), 
              child: new Text(
              projectModel[index] 
               .branchesModel 
               .hostelType, 
              style: new TextStyle(
               fontSize: 18.0, 
              ), 
             ), 
             ), 
             ], 
            ), 
           ), 
           ], 
          ), 
          ), 
          new Container(
           margin: const EdgeInsets.fromLTRB(
            16.0, 8.0, 16.0, 4.0), 
           child: new Row(children: <Widget>[ 
           new Text(
            projectModel[index].branchesModel.branchName, 
            style: new TextStyle(
            fontSize: 24.0, 
           ), 
           ), 
           ]), 
          ), 
          new Container(
           margin: const EdgeInsets.only(
            left: 16.0, right: 16.0, bottom: 8.0), 
           child: new Row(
           children: <Widget>[ 
            new Text(
             projectModel[index].branchesModel.city), 
           ], 
          ), 
          ), 
          ], 
         ), 
        ), 
        ); // InkWell ends here so this has to go into ListView.builder 
        }, 
       ), // ListView.builder ends here. 
      ), 
    ), 
    ); 
    } 
} 

ダーツ。 Mahi。

関連する問題