Home > Enterprise >  How I use data from database So that I don't Have to add hundred thousand of images in assets i
How I use data from database So that I don't Have to add hundred thousand of images in assets i

Time:01-09

Beginner here, I have never used database before. I am creating an flutter app which contain product images and its affiliate link...but my app size is getting bigger because in assests i have uploaded hundreds of images which is taking lots of space.. Is there any way i can fetch data from backend or something like that ...

enter image description here

i want this type of UI.. enter image description here

And this my code for it...

enter code here: SliverToBoxAdapter(
        child: SizedBox(
          child: Column(
            children: [
              // ignore: prefer_const_constructors
              Padding(
                padding: const EdgeInsets.only(right: 210.0),
                // ignore: prefer_const_constructors
                child: Text(
                  "Great Personality",
                  // ignore: prefer_const_constructors
                  style: TextStyle(
                    color: Colors.white,
                    fontWeight: FontWeight.bold,
                    fontSize: 20.0,
                  ),
                ),
              ),
              Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: SizedBox(
                      height: 200,
                      child: ListView(
                        scrollDirection: Axis.horizontal,
                        children: [
                          Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: InkWell(
                              child: Container(
                                width: 120,
                                color: Colors.amber,
                              ),
                            ),
                          ),
                          Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Container(
                              width: 120,
                              color: Colors.white,
                            ),
                          ),
                          Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Container(
                              width: 120,
                              color: Colors.white,
                            ),
                          ),
                          Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Container(
                              width: 120,
                              color: Colors.white,
                            ),
                          ),
                          Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Container(
                              width: 120,
                              color: Colors.white,
                            ),
                          ),
                          Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Container(
                              width: 120,
                              color: Colors.white,
                            ),
                          ),
                        ],
                      ),
                    ),
                  )
                ],
              )
            ],
          ),
        ),
      ),         

CodePudding user response:

if your app will work on ofline mode it will crash

CodePudding user response:

Yes, Use Firebase Storage to store your images and fetch images from there.

CodePudding user response:

Use Cached Network Image and fetch from firebase or any other server. (Works offline as long as the image has been loaded before.)

  •  Tags:  
  • Related