1

我正在尝试使用颤振从云 Firestore 中检索一些数据。我使用循环进度指示器显示它仍在获取数据,但它继续运行,就好像它没有收到任何数据一样。我是新来的,所以我不知道为什么会这样,我已经尝试了一切(可能与设置状态有关,但我不太清楚这个概念)

我没有收到任何错误,但应用程序没有从 Firestore 数据库中获取信息。分享完整代码

完整代码

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';



import 'login_caller.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
// This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    Future getdata() async{
      final firestore =FirebaseFirestore.instance;
      await Firebase.initializeApp();
      QuerySnapshot snapshot =await firestore.collection('CanUSupport').get();
      return await snapshot.docs;
    }
    var document = [];
    var foundations = [
      {
        'Name': 'Sanshil Foundation for Welfare',
        'Requirements': ['Chairs (6)', 'Tables (234)'],
      },
      {
        'Name': 'Ram Kala Sadan Trust',
        'Requirements': ['Chairs (5)', 'Tables (7)', 'Pencils (7899)'],
      },
    ];
    var call = [
      {
        'Name': 'Sanshil Foundation for Welfare',
        'Number': '098733 29733',
      },
      {
        'Name': 'Ram Kala Sadan Trust',
        'Number': "072918 25705",
      },
    ];

    var location = [
      'https://www.google.com/maps/place/Sanshil+foundation/@28.4251672,77.0588316,17z/data=!4m8!1m2!2m1!1ssanshil+foundation+project+bagiya!3m4!1s0x390d188208cdac35:0xba90a7675ebc860d!8m2!3d28.4253544!4d77.0630471',
      'https://www.google.co.in/maps/place/Smile+Foundation/@28.5578955,77.1731021,13z/data=!4m8!1m2!2m1!1sSmile+foundation!3m4!1s0x390ce270271eadef:0xb8e42773f9d463ab!8m2!3d28.5578955!4d77.208121',
    ];
    var images = [
      'assets/logos/Sanshil-Logo.png',
      'assets/logos/bagiya logo.jpg',
    ];

    var site = [
      {
        'Name': 'Sanshil Foundation for Welfare',
        'site': 'https://sanshil.com/',
      },
      {
        'Name': 'Ram Kala Sadan Trust',
        'site': 'https://www.ramkalasadan.org/',
      }
    ];
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
    return new MaterialApp(
      color: Colors.yellow,
      home: DefaultTabController(
        length: 3,
        child: new Scaffold(
          appBar: AppBar(
            title: Text(
              'CanUSupport',
              style: TextStyle(
                  fontSize: 30,
                  color: Color.fromRGBO(1, 1, 1, 1),
                  fontFamily: 'Pt_Mono'),
            ),
            backgroundColor: Color(0xffDB9D12),
          ),
          body: TabBarView(
            children: [
              new Scaffold(
                backgroundColor: Color(0xffDB9D12),
                body: FutureBuilder(
                  future: getdata(),


                  builder: (context,snapshot){
                    if(!snapshot.hasData) {
                      return Center(child : CircularProgressIndicator());
                    }
                    else {



                      return ListView.builder(
                          itemCount: snapshot.data.length,
                          itemBuilder: (context, index) {
                            return Container(
                              margin: EdgeInsets.all(16),
                              child: Stack(
                                children: <Widget>[
                                  Card(
                                    elevation: 12,
                                    shape: RoundedRectangleBorder(
                                      borderRadius: BorderRadius.circular(30),
                                    ),
                                    color: Colors.white,
                                    child: Container(
                                      padding: const EdgeInsets.symmetric(
                                          horizontal: 24.0, vertical: 18),
                                      decoration: BoxDecoration(
                                        borderRadius: BorderRadius.circular(30),
                                        gradient: LinearGradient(colors: [
                                          Color.fromRGBO(204, 204, 204, 1),
                                          Color.fromRGBO(179, 179, 179, 1),
                                          Color.fromRGBO(140, 140, 140, 1),
                                        ]),
                                      ),
                                      child: Row(
                                        mainAxisAlignment:
                                        MainAxisAlignment.spaceBetween,
                                        children: <Widget>[
                                          Container(
                                            padding:
                                            EdgeInsets.fromLTRB(0, 0, 10, 0),
                                            child: CircleAvatar(
                                                radius: 45,
                                                backgroundImage:
                                                AssetImage(images[index])),
                                          ),
                                          Expanded(
                                            child: Column(
                                              crossAxisAlignment:
                                              CrossAxisAlignment.start,
                                              mainAxisSize: MainAxisSize.min,
                                              children: <Widget>[
                                                Text(
                                                  snapshot.data[index].data['Name'],
                                                  style: Theme.of(context)
                                                      .textTheme
                                                      .headline5
                                                      .copyWith(
                                                      color: Colors.white),
                                                ),
                                                Column(
                                                  children: <Widget>[
                                                    for (var item
                                                    in foundations[index]
                                                    ['Requirements'])
                                                      Text('• ' + item)
                                                  ],
                                                )
                                              ],
                                            ),
                                          ),
                                          Column(children: [
                                            ClipOval(
                                              child: Material(
                                                color: Colors.white, // button color
                                                child: InkWell(
                                                  splashColor: Color(
                                                      0xFFbc8510), // inkwell color
                                                  child: SizedBox(
                                                      width: 56,
                                                      height: 56,
                                                      child: Icon(Icons.call)),
                                                  onTap: () {
                                                    _launchUrlcall(
                                                        call[index]['Number']);
                                                  },
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding: EdgeInsets.all(5.0),
                                            ),
                                            ClipOval(
                                              child: Material(
                                                color: Colors.white, // button color
                                                child: InkWell(
                                                  splashColor: Color(
                                                      0xFFbc8510), // inkwell color
                                                  child: SizedBox(
                                                      width: 56,
                                                      height: 56,
                                                      child: Icon(Icons.map)),
                                                  onTap: () {
                                                    _launchMapsUrl(
                                                      location[index],
                                                    );
                                                  },
                                                ),
                                              ),
                                            ),
                                            Padding(
                                              padding: EdgeInsets.all(5.0),
                                            ),
                                            ClipOval(
                                              child: Material(
                                                color: Colors.white, // button color
                                                child: InkWell(
                                                  splashColor: Color(
                                                      0xFFbc8510), // inkwell color
                                                  child: SizedBox(
                                                      width: 56,
                                                      height: 56,
                                                      child: Icon(Icons.web_sharp)),
                                                  onTap: () {
                                                    _launchUrlweb(
                                                        site[index]['site']);
                                                  },
                                                ),
                                              ),
                                            ),
                                          ]),
                                        ],
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            );
                          });
                    }

                  }
                  ,

                ),
              ),
              new Container(
                child: login_caller(),
              ),
              new Container(
                padding: EdgeInsets.symmetric(
                  horizontal: 10.0,
                  vertical: 100.0,
                ),
                height: double.infinity,
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [
                      Color(0xFFf7dca1),
                      Color(0xFFf1c15b),
                      Color(0xFFeba714),
                      Color(0xFFbc8510),
                    ],
                    stops: [0.1, 0.4, 0.7, 0.9],
                  ),
                ),
                child: SingleChildScrollView(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text(
                        'About us',
                        style: TextStyle(
                            color: Colors.white,
                            fontFamily: 'OpenSans',
                            fontSize: 30,
                            fontWeight: FontWeight.bold),
                      ),
                      Padding(padding: EdgeInsets.symmetric(vertical: 10.0)),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: <Widget>[
                          GestureDetector(
                            onTap: () {
                              _launchURLsite();
                            },
                            child: Container(
                              height: 60.0,
                              width: 60.0,
                              child: InkWell(
                                splashColor: Color(0xFFbc8510),
                              ),
                              decoration: BoxDecoration(
                                shape: BoxShape.circle,
                                color: Colors.white,
                                boxShadow: [
                                  BoxShadow(
                                    color: Colors.black26,
                                    offset: Offset(0, 2),
                                    blurRadius: 6.0,
                                  ),
                                ],
                                image: DecorationImage(
                                  image: NetworkImage(
                                      'https://www.googlewatchblog.de/wp-content/uploads/google-logo-perfekt.jpg'),
                                ),
                              ),
                            ),
                          ),
                          GestureDetector(
                            onTap: () {
                              _launchURLface();
                            },
                            child: Container(
                              height: 60.0,
                              width: 60.0,
                              child: InkWell(
                                splashColor: Color(0xFFbc8510),
                              ),
                              decoration: BoxDecoration(
                                shape: BoxShape.circle,
                                color: Colors.white,
                                boxShadow: [
                                  BoxShadow(
                                    color: Colors.black26,
                                    offset: Offset(0, 2),
                                    blurRadius: 6.0,
                                  ),
                                ],
                                image: DecorationImage(
                                  image: NetworkImage(
                                      'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTWHNqSKP0g_42wo-gQv1azrnztIYv1RbZKnQ&usqp=CAU'),
                                ),
                              ),
                            ),
                          ),
                          GestureDetector(
                            onTap: () {
                              _launchURLinsta();
                            },
                            child: Container(
                              height: 60.0,
                              width: 60.0,
                              child: InkWell(
                                splashColor: Color(0xFFbc8510),
                              ),
                              decoration: BoxDecoration(
                                shape: BoxShape.circle,
                                color: Colors.white,
                                boxShadow: [
                                  BoxShadow(
                                    color: Colors.black26,
                                    offset: Offset(0, 2),
                                    blurRadius: 6.0,
                                  ),
                                ],
                                image: DecorationImage(
                                  image: NetworkImage(
                                      'https://www.pollutionprobe.org/wp-content/uploads/insta-logo-300x300.png'),
                                ),
                              ),
                            ),
                          ),
                        ],
                      ),
                      Padding(padding: EdgeInsets.symmetric(vertical: 10.0)),
                      Text(
                        'Divij Dhiraaj',
                        style: TextStyle(
                            color: Colors.white,
                            fontFamily: 'OpenSans',
                            fontSize: 30,
                            fontWeight: FontWeight.bold),
                        textAlign: TextAlign.left,
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(
                          horizontal: 20.0,
                          vertical: 15.0,
                        ),
                        child: Text(
                          'Hi! My name is Divij Dhiraaj and I\'m the co-founder of CanUsupport. I’m a Seventeen year old student studying the The Shri Ram School , Aravali. \n \n When Aryan first approached me with the idea of building a platform to connect the less- known NGOs who are in dire need of funds, I resonated with his though process for that is same stumbling block me and my family encounter when trying to donate. Most potential donors are only aware of the well established NGOs , not knowing that there might just be a smaller NGO in their area ,working towards community well-fare, lacking funds and donations. \n \n While creating this site , that was our goal: to connect the less-established NGOs with donors so that the effect of their donations is maximised.',
                          style: TextStyle(
                              color: Colors.white,
                              fontFamily: 'OpenSans',
                              fontSize: 16,
                              fontWeight: FontWeight.bold),
                          textAlign: TextAlign.left,
                        ),
                      ),
                      Text(
                        'Aryan Jalota',
                        style: TextStyle(
                            color: Colors.white,
                            fontFamily: 'OpenSans',
                            fontSize: 30,
                            fontWeight: FontWeight.bold),
                        textAlign: TextAlign.left,
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(
                          horizontal: 20.0,
                          vertical: 15.0,
                        ),
                        child: Text(
                          'Hi! I\’m Aryan Jalota and I’m the founder of CanUSupport. I\’m a seventeen year old student currently studying in the Shri Ram School, Aravali. \n \n My family and I have been active contributors to many NGOs, but there was one challenge we faced the most when it came to donating – what should we donate? For instance, the first thing which comes to our mind will be stationary and notebooks for NGOs and learning centres; however, NGOs receive these donations in bulk from various people, and the societal impact that donors want to make is minimised. \n \n Therefore, I decided to create a platform over the summer which can directly connect various NGOs and learning centres to the local community. This way, donors can directly donate according to the requirements of the NGOs, ultimately maximising the impact on the society.',
                          style: TextStyle(
                              color: Colors.white,
                              fontFamily: 'OpenSans',
                              fontSize: 16,
                              fontWeight: FontWeight.bold),
                          textAlign: TextAlign.left,
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
          bottomNavigationBar: new TabBar(
            tabs: [
              Tab(
                icon: new Icon(Icons.home),
              ),
              Tab(
                icon: new Icon(Icons.perm_identity),
              ),
              Tab(
                icon: new Icon(Icons.settings),
              )
            ],
            labelColor: Colors.yellow,
            unselectedLabelColor: Colors.black,
            indicatorSize: TabBarIndicatorSize.label,
            indicatorPadding: EdgeInsets.all(5.0),
            indicatorColor: Colors.red,
          ),
          backgroundColor: Color(0xff707070),
        ),
      ),
    );
  }

  _launchURLsite() async {
    const url = 'https://canusupport.com/';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchURLinsta() async {
    const url = 'https://www.instagram.com/canusupport/';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchUrlcall(String url) async {
    if (await canLaunch(url)) {
      launch(url);
    } else {
      throw "Could not launch $url";
    }
  }

  _launchMapsUrl(String loca) async {
    final url = loca;
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchUrlmail(String url) async {
    if (await canLaunch(url)) {
      launch(url);
    } else {
      throw "Could not launch $url";
    }
  }

  _launchURLface() async {
    const url = 'https://www.facebook.com/canusupport/';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchUrlweb(String url) async {
    if (await canLaunch(url)) {
      launch(url);
    } else {
      throw "Could not launch $url";
    }
  }
}

该错误似乎在列表视图构建器中。任何帮助将不胜感激,因为这是我长期以来一直在从事的项目。var 基础也只是虚拟值。

4

1 回答 1

1

我建议坚持使用 docs 中的方式,特别是如果您是 firestore 新手。

这不仅会真正起作用,而且在处理更改时也会更高效、更容易。

这是您修改的代码,希望这对您有用:

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
// This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    CollectionReference canUSupport = FirebaseFirestore.instance.collection('CanUSupport');
    var foundations = [
      {
        'Name': 'Sanshil Foundation for Welfare',
        'Requirements': ['Chairs (6)', 'Tables (234)'],
      },
      {
        'Name': 'Ram Kala Sadan Trust',
        'Requirements': ['Chairs (5)', 'Tables (7)', 'Pencils (7899)'],
      },
    ];
    var call = [
      {
        'Name': 'Sanshil Foundation for Welfare',
        'Number': '098733 29733',
      },
      {
        'Name': 'Ram Kala Sadan Trust',
        'Number': "072918 25705",
      },
    ];

    var location = [
      'https://www.google.com/maps/place/Sanshil+foundation/@28.4251672,77.0588316,17z/data=!4m8!1m2!2m1!1ssanshil+foundation+project+bagiya!3m4!1s0x390d188208cdac35:0xba90a7675ebc860d!8m2!3d28.4253544!4d77.0630471',
      'https://www.google.co.in/maps/place/Smile+Foundation/@28.5578955,77.1731021,13z/data=!4m8!1m2!2m1!1sSmile+foundation!3m4!1s0x390ce270271eadef:0xb8e42773f9d463ab!8m2!3d28.5578955!4d77.208121',
    ];
    var images = [
      'assets/logos/Sanshil-Logo.png',
      'assets/logos/bagiya logo.jpg',
    ];

    var site = [
      {
        'Name': 'Sanshil Foundation for Welfare',
        'site': 'https://sanshil.com/',
      },
      {
        'Name': 'Ram Kala Sadan Trust',
        'site': 'https://www.ramkalasadan.org/',
      }
    ];
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
    return new MaterialApp(
      color: Colors.yellow,
      home: DefaultTabController(
        length: 3,
        child: new Scaffold(
          appBar: AppBar(
            title: Text(
              'CanUSupport',
              style: TextStyle(
                  fontSize: 30, color: Color.fromRGBO(1, 1, 1, 1), fontFamily: 'Pt_Mono'),
            ),
            backgroundColor: Color(0xffDB9D12),
          ),
          body: TabBarView(
            children: [
              new Scaffold(
                backgroundColor: Color(0xffDB9D12),
                body: StreamBuilder<QuerySnapshot>(
                  stream: canUSupport.snapshots(),
                  builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
                    if (snapshot.hasError) {
                      return Text('Something went wrong');
                    }

                    if (snapshot.connectionState == ConnectionState.waiting) {
                      return Center(child: CircularProgressIndicator());
                    }

                    return ListView.builder(
                        itemCount: snapshot.data.size,
                        itemBuilder: (context, index) {
                          return Container(
                            margin: EdgeInsets.all(16),
                            child: Stack(
                              children: <Widget>[
                                Card(
                                  elevation: 12,
                                  shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(30),
                                  ),
                                  color: Colors.white,
                                  child: Container(
                                    padding: const EdgeInsets.symmetric(
                                        horizontal: 24.0, vertical: 18),
                                    decoration: BoxDecoration(
                                      borderRadius: BorderRadius.circular(30),
                                      gradient: LinearGradient(colors: [
                                        Color.fromRGBO(204, 204, 204, 1),
                                        Color.fromRGBO(179, 179, 179, 1),
                                        Color.fromRGBO(140, 140, 140, 1),
                                      ]),
                                    ),
                                    child: Row(
                                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                      children: <Widget>[
                                        Container(
                                          padding: EdgeInsets.fromLTRB(0, 0, 10, 0),
                                          child: CircleAvatar(
                                              radius: 45,
                                              backgroundImage: AssetImage(images[index])),
                                        ),
                                        Expanded(
                                          child: Column(
                                            crossAxisAlignment: CrossAxisAlignment.start,
                                            mainAxisSize: MainAxisSize.min,
                                            children: <Widget>[
                                              Text(
                                                snapshot.data.docs[index].data()['Name'],
                                                style: Theme.of(context)
                                                    .textTheme
                                                    .headline5
                                                    .copyWith(color: Colors.white),
                                              ),
                                              Column(
                                                children: <Widget>[
                                                  for (var item in foundations[index]
                                                  ['Requirements'])
                                                    Text('• ' + item)
                                                ],
                                              )
                                            ],
                                          ),
                                        ),
                                        Column(children: [
                                          ClipOval(
                                            child: Material(
                                              color: Colors.white, // button color
                                              child: InkWell(
                                                splashColor:
                                                Color(0xFFbc8510), // inkwell color
                                                child: SizedBox(
                                                    width: 56,
                                                    height: 56,
                                                    child: Icon(Icons.call)),
                                                onTap: () {
                                                  _launchUrlcall(call[index]['Number']);
                                                },
                                              ),
                                            ),
                                          ),
                                          Padding(
                                            padding: EdgeInsets.all(5.0),
                                          ),
                                          ClipOval(
                                            child: Material(
                                              color: Colors.white, // button color
                                              child: InkWell(
                                                splashColor:
                                                Color(0xFFbc8510), // inkwell color
                                                child: SizedBox(
                                                    width: 56,
                                                    height: 56,
                                                    child: Icon(Icons.map)),
                                                onTap: () {
                                                  _launchMapsUrl(
                                                    location[index],
                                                  );
                                                },
                                              ),
                                            ),
                                          ),
                                          Padding(
                                            padding: EdgeInsets.all(5.0),
                                          ),
                                          ClipOval(
                                            child: Material(
                                              color: Colors.white, // button color
                                              child: InkWell(
                                                splashColor:
                                                Color(0xFFbc8510), // inkwell color
                                                child: SizedBox(
                                                    width: 56,
                                                    height: 56,
                                                    child: Icon(Icons.web_sharp)),
                                                onTap: () {
                                                  _launchUrlweb(site[index]['site']);
                                                },
                                              ),
                                            ),
                                          ),
                                        ]),
                                      ],
                                    ),
                                  ),
                                ),
                              ],
                            ),
                          );
                        });
                  },
                ),
              ),
              new Container(
                child: login_caller(),
              ),
              new Container(
                padding: EdgeInsets.symmetric(
                  horizontal: 10.0,
                  vertical: 100.0,
                ),
                height: double.infinity,
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [
                      Color(0xFFf7dca1),
                      Color(0xFFf1c15b),
                      Color(0xFFeba714),
                      Color(0xFFbc8510),
                    ],
                    stops: [0.1, 0.4, 0.7, 0.9],
                  ),
                ),
                child: SingleChildScrollView(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text(
                        'About us',
                        style: TextStyle(
                            color: Colors.white,
                            fontFamily: 'OpenSans',
                            fontSize: 30,
                            fontWeight: FontWeight.bold),
                      ),
                      Padding(padding: EdgeInsets.symmetric(vertical: 10.0)),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: <Widget>[
                          GestureDetector(
                            onTap: () {
                              _launchURLsite();
                            },
                            child: Container(
                              height: 60.0,
                              width: 60.0,
                              child: InkWell(
                                splashColor: Color(0xFFbc8510),
                              ),
                              decoration: BoxDecoration(
                                shape: BoxShape.circle,
                                color: Colors.white,
                                boxShadow: [
                                  BoxShadow(
                                    color: Colors.black26,
                                    offset: Offset(0, 2),
                                    blurRadius: 6.0,
                                  ),
                                ],
                                image: DecorationImage(
                                  image: NetworkImage(
                                      'https://www.googlewatchblog.de/wp-content/uploads/google-logo-perfekt.jpg'),
                                ),
                              ),
                            ),
                          ),
                          GestureDetector(
                            onTap: () {
                              _launchURLface();
                            },
                            child: Container(
                              height: 60.0,
                              width: 60.0,
                              child: InkWell(
                                splashColor: Color(0xFFbc8510),
                              ),
                              decoration: BoxDecoration(
                                shape: BoxShape.circle,
                                color: Colors.white,
                                boxShadow: [
                                  BoxShadow(
                                    color: Colors.black26,
                                    offset: Offset(0, 2),
                                    blurRadius: 6.0,
                                  ),
                                ],
                                image: DecorationImage(
                                  image: NetworkImage(
                                      'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTWHNqSKP0g_42wo-gQv1azrnztIYv1RbZKnQ&usqp=CAU'),
                                ),
                              ),
                            ),
                          ),
                          GestureDetector(
                            onTap: () {
                              _launchURLinsta();
                            },
                            child: Container(
                              height: 60.0,
                              width: 60.0,
                              child: InkWell(
                                splashColor: Color(0xFFbc8510),
                              ),
                              decoration: BoxDecoration(
                                shape: BoxShape.circle,
                                color: Colors.white,
                                boxShadow: [
                                  BoxShadow(
                                    color: Colors.black26,
                                    offset: Offset(0, 2),
                                    blurRadius: 6.0,
                                  ),
                                ],
                                image: DecorationImage(
                                  image: NetworkImage(
                                      'https://www.pollutionprobe.org/wp-content/uploads/insta-logo-300x300.png'),
                                ),
                              ),
                            ),
                          ),
                        ],
                      ),
                      Padding(padding: EdgeInsets.symmetric(vertical: 10.0)),
                      Text(
                        'Divij Dhiraaj',
                        style: TextStyle(
                            color: Colors.white,
                            fontFamily: 'OpenSans',
                            fontSize: 30,
                            fontWeight: FontWeight.bold),
                        textAlign: TextAlign.left,
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(
                          horizontal: 20.0,
                          vertical: 15.0,
                        ),
                        child: Text(
                          'Hi! My name is Divij Dhiraaj and I\'m the co-founder of CanUsupport. I’m a Seventeen year old student studying the The Shri Ram School , Aravali. \n \n When Aryan first approached me with the idea of building a platform to connect the less- known NGOs who are in dire need of funds, I resonated with his though process for that is same stumbling block me and my family encounter when trying to donate. Most potential donors are only aware of the well established NGOs , not knowing that there might just be a smaller NGO in their area ,working towards community well-fare, lacking funds and donations. \n \n While creating this site , that was our goal: to connect the less-established NGOs with donors so that the effect of their donations is maximised.',
                          style: TextStyle(
                              color: Colors.white,
                              fontFamily: 'OpenSans',
                              fontSize: 16,
                              fontWeight: FontWeight.bold),
                          textAlign: TextAlign.left,
                        ),
                      ),
                      Text(
                        'Aryan Jalota',
                        style: TextStyle(
                            color: Colors.white,
                            fontFamily: 'OpenSans',
                            fontSize: 30,
                            fontWeight: FontWeight.bold),
                        textAlign: TextAlign.left,
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(
                          horizontal: 20.0,
                          vertical: 15.0,
                        ),
                        child: Text(
                          'Hi! I\’m Aryan Jalota and I’m the founder of CanUSupport. I\’m a seventeen year old student currently studying in the Shri Ram School, Aravali. \n \n My family and I have been active contributors to many NGOs, but there was one challenge we faced the most when it came to donating – what should we donate? For instance, the first thing which comes to our mind will be stationary and notebooks for NGOs and learning centres; however, NGOs receive these donations in bulk from various people, and the societal impact that donors want to make is minimised. \n \n Therefore, I decided to create a platform over the summer which can directly connect various NGOs and learning centres to the local community. This way, donors can directly donate according to the requirements of the NGOs, ultimately maximising the impact on the society.',
                          style: TextStyle(
                              color: Colors.white,
                              fontFamily: 'OpenSans',
                              fontSize: 16,
                              fontWeight: FontWeight.bold),
                          textAlign: TextAlign.left,
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
          bottomNavigationBar: new TabBar(
            tabs: [
              Tab(
                icon: new Icon(Icons.home),
              ),
              Tab(
                icon: new Icon(Icons.perm_identity),
              ),
              Tab(
                icon: new Icon(Icons.settings),
              )
            ],
            labelColor: Colors.yellow,
            unselectedLabelColor: Colors.black,
            indicatorSize: TabBarIndicatorSize.label,
            indicatorPadding: EdgeInsets.all(5.0),
            indicatorColor: Colors.red,
          ),
          backgroundColor: Color(0xff707070),
        ),
      ),
    );
  }

  _launchURLsite() async {
    const url = 'https://canusupport.com/';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchURLinsta() async {
    const url = 'https://www.instagram.com/canusupport/';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchUrlcall(String url) async {
    if (await canLaunch(url)) {
      launch(url);
    } else {
      throw "Could not launch $url";
    }
  }

  _launchMapsUrl(String loca) async {
    final url = loca;
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchUrlmail(String url) async {
    if (await canLaunch(url)) {
      launch(url);
    } else {
      throw "Could not launch $url";
    }
  }

  _launchURLface() async {
    const url = 'https://www.facebook.com/canusupport/';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  _launchUrlweb(String url) async {
    if (await canLaunch(url)) {
      launch(url);
    } else {
      throw "Could not launch $url";
    }
  }
}
于 2020-10-22T13:47:08.680 回答