Git Product home page Git Product logo

Comments (4)

vinceramcesoliveros avatar vinceramcesoliveros commented on August 15, 2024

I just want to test out this feature. the draw back is to not push their pubspec.yaml file. bale gagamitin lang yung github raw user content to load images on the network instead of assets. So that we can dynamically load these images.

class DevImage extends StatelessWidget {
  const DevImage(this.imageSource);
  final String imageSource;
  
  @override
  Widget build(BuildContext context) {
    if (kDebugMode) {
      return Image.asset(imageSource);
    }
    return Image.network("https://raw.githubusercontent.com/flutterph/devs/master/${imageSource}");
  }
}

What do you think @joshuadeguzman?

from devs.

joshuadeguzman avatar joshuadeguzman commented on August 15, 2024

Hi @Ram231 ,

Thanks for looking into this.

I think we can also simplify this, we can ask for the Github username instead.

https://avatars.githubusercontent.com/<username>

For example

https://avatars.githubusercontent.com/joshuadeguzman

Before working on this, the links for social handles #19 should be landed first.

At least with this one we will not "host" the assets for these.

What are your thoughts?

from devs.

vinceramcesoliveros avatar vinceramcesoliveros commented on August 15, 2024

I think that's good. the file name should be their username so that there won't be overwritten files when they PR.
Example Code:

class DevImage extends StatelessWidget {
  const DevImage({this.imageSource,this.username});
  final String imageSource; // assets/dev/profile/ram231.png
  final String username;  // ram231
  @override
  Widget build(BuildContext context) {
    if (kDebugMode) {
      return Image.asset(imageSource);
    }
    return Image.network("https://raw.githubusercontent.com/$username/devs/master/${imageSource}");
  }
}

Above code is just a concept. Although it works like that as long as we have a fallback image(placeholder) if the forked repo was archived/deleted.

from devs.

Jansalvador1445 avatar Jansalvador1445 commented on August 15, 2024

This is merged

from devs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.