GridView not displaying

I want to display name,description and image in GridView.

export default function NFTViewer({
}) {

  const [galleryList, setGalleryList] = useState([]);
  const metadata = [];
  const cardActions = [];

  const [data, setData] = useState()


  useEffect(() => {

    const getNFTDetails = () => {
      fetch("http://localhost:4000/getDetails").then(response => {
        return response.json()
      })
        .then(posts => {
          setData(posts)

        })
        .then((err) => {
          console.log(err);
        })
    }
    getNFTDetails()
  }, []);

  useEffect(() => {
    handleData();
  }, [data])

  const handleData = async () => {
    const list = [];
    for (const a in data) {
      metadata[a] = await fetchIpfsJsonFromCid(data[a].cid);

      metadata[a].image = makeGatewayURL(metadata[a].image);
      console.log("image url " + metadata[a].image)

      list.push(
        <Card
          style={{ width: 200 }}
          key={data[a].name}
          title={
            <div>
              {data[a].name}
              <a target='_blank' rel='noreferrer'>
              </a>
            </div>
          }
        >
          <img src={metadata[a].image} style={{ height:50,width: 130 }} />
          <div style={{ opacity: 0.77 }}>{data[a].description}</div>
        </Card>
      );
    }
    setGalleryList(list);
  };

  return (
    <div
      style={{
        maxWidth: 820,
        margin: 'auto',
        marginTop: 32,
        paddingBottom: 256,
      }}
    >
      <StackGrid columnWidth={200} gutterWidth={16} gutterHeight={16}>
        {galleryList}
      </StackGrid>
    </div>
  )
}

In console, I can see it print https://dweb.link/ipfs/bafybeicyb5zpppsdyu5fxxx/image.png,which is valid image link, but display blank in web page.

L2eJT.png

But if I remove these two lines code,and put the valid image url, it able to display the data.

These 2 codes removed

  metadata[a] = await fetchIpfsJsonFromCid(data[a].cid);
  metadata[a].image = makeGatewayURL(metadata[a].image);

and replace valid image url from

 <img src={metadata[a].image} style={{ height:50,width: 130 }} />

to

<img src={https://dweb.link/ipfs/bafybeicyb5zpppsdyu5fxxx/image.png} style={{ height:50,width: 130 }} />

It able to display

ZDtUe.png

How to fix?!

Header color and font style not changing

Why header background not changing to red and font style not changing to coiny?

index.js

import Head from 'next/head'
import Image from 'next/image'

export default function Home() {
  return (
    <div className="min-h-screen h-full w-full flex flex-col bg-brand-light overflow-hidden">
      <Head>
        <title>Create Next App</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.ico" />
      </Head>

      <main className='bg-red-700'>
        <h1 className='font-coiny'>
          Welcome to <a href="https://nextjs.org">Next.js!</a>
        </h1>
      </main>
    </div>
  )
}

tailwind.config.js

const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
  content: [
    './pages/**/*.{js,ts,jsx,tsx}',
    './components/**/*.{js,ts,jsx,tsx}'
  ],
  theme: {
    extend: {
      fontFamily: {
        coiny: ['Coiny', ...defaultTheme.fontFamily.sans]
      },
    }, colors: {
      'brand-purple': 'var(--clr-purple)',
      'brand-pink': 'var(--clr-pink)',
      'brand-yellow': 'var(--clr-yellow)',
      'brand-blue': 'var(--clr-blue)',
      'brand-green': 'var(--clr-green)',
      'brand-light': 'var(--clr-light)',
      'brand-background': 'var(--clr-background)'
    },
  },
  plugins: [],
}

global.css

@import url('https://fonts.googleapis.com/css2?family=Coiny&family=Open+Sans:wght@400;500;600&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --font-family: 'Open Sans', sans-serif;
  --clr-light: #f0e9e9;
  --clr-purple: #9b5de5;
  --clr-pink: #f15bb5;
  --clr-yellow: #fee440;
  --clr-blue: #00bbf9;
  --clr-green: #00f5d4;
  --clr-selection-bg: #cb3d92;
  --clr-selection-text: #f4f0f0;
  --clr-background: #06070a;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-family);
  background: var(--clr-background);
}

::selection {
  background: var(--clr-selection-bg);
  color: var(--clr-selection-text);
}

_app.js

import '../styles/globals.css'

function MyApp({ Component, pageProps }) {
  return <Component {...pageProps} />
}

export default MyApp
package.json

{
  "name": "nft-minting-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "13.0.5",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "tailwindcss": "^3.2.4"
  }
}

Output

UioVB.png

Software for creating image

I've been code for android/ios using flutter more than a year. Now I would like to learn new things by using software to create image instead of just getting icons from google material design (just like image below).

Any recommended ? Thanks.

104648412-d93f8f00-5691-11eb-94e9-d1ecedd7c9f8.png

StreamSubscription calling from another class

In my main activity, I have two tab, named tab1 and tab 2. Tab 2 page consists of a listView and I use StreamSubscription to listen upload progress result. On tab2 action bar, it has one icon. When icon is pressed, it will navigate to pageC,which consists of listView, and I use StreamSubscription too.

The problem is I notice when I upload image in PageC, it will display the upload progress in Tab2 page first, then only it will display upload progress in pageC. Why would this happened?

I defined subscription in both page as below

StreamSubscription<UploadTaskResponse> _subscription;
FlutterUploader uploader = FlutterUploader();

  @override
  void initState() {
    super.initState();

    _subscription = uploader.result.listen(
      (result) {
         print("Printing in pageC");
          ....
      },
      onError: (ex, stacktrace) {
      },
    );
    });
  }

I have defined the cancel() in both class too

 void dispose() {
    super.dispose();
    _subscription.cancel();
  }

Output

printing in Tab2
printing in PageC

MPAndroidChart x-axis not dislpay all value

I drawing line chart using MPAndroidChart library.

I would like the x-axis display the date of September

1/09, 6/09, 11/09,16/09,21/09,26/09

Code

 xAxis.valueFormatter = IndexAxisValueFormatter(weekdays)
 xAxis.setLabelCount(5, true)
 xAxis.axisMinimum = 0f
 xAxis.axisMaximum = 30f
 xAxis.granularity = 5f
 xAxis.position = XAxis.XAxisPosition.BOTTOM

weekdays is

 [1 / 09, 2 / 09, 3 / 09, 4 / 09, 5 / 09, 6 / 09, 7 / 09, 8 / 09, 9 / 09, 10 / 09, 11 / 09, 12 / 09, 13 / 09, 14 / 09, 15 / 09, 16 / 09, 17 / 09, 18 / 09, 19 / 09, 20 / 09, 21 / 09, 22 / 09, 23 / 09, 24 / 09, 25 / 09, 26 / 09, 27 / 09, 28 / 09, 29 / 09, 30 / 09, 1 / 09, 2 / 09, 3 / 09, 4 / 09, 5 / 09, 6 / 09, 7 / 09, 8 / 09, 9 / 09, 10 / 09, 11 / 09, 12 / 09, 13 / 09, 14 / 09, 15 / 09, 16 / 09, 17 / 09, 18 / 09, 19 / 09, 20 / 09, 21 / 09, 22 / 09, 23 / 09, 24 / 09, 25 / 09, 26 / 09, 27 / 09, 28 / 09, 29 / 09, 30 / 09]

It looked simple, but the x-axis just not showing all !

156939874510505023_(2).png

Please be aware of the Momo Challenge !

Parents please be aware and very cautious of what your child watches on YouTube and KIDS YOUTUBE. There is a thing called ‘Momo’ that’s instructing kids to kill themselves, turn stoves on while everyone is sleep and even threatening to kill the children if they tell their parents!!!

download.jpeg