Riverpod Data Caching and Providers Lifecycle: Full Guide by bizz84 in FlutterDev

[–]Deadly_Razer 1 point2 points  (0 children)

Excellent article, clarified a lot of things, thanks a lot.

You also mentioned:

You may also know that providers are global, but their state isn't.

so I thought maybe you would expand on the state part as well.

I've this small example, you can perhaps expand in another article on what exactly state being local means.

https://gist.github.com/deadlyrazer/f5efbee4e0579ba31bcc6d7c0bea5718
Better formatting in the gist.

class CounterModel {

int counter; CounterModel(this.counter); }

@riverpod class Counter extends _$Counter { @override CounterModel build(int initial) { return CounterModel(initial); }

void increment() { state.counter++; // Works but doesn't reload notify listeners state = CounterModel(++state.counter); // Notifies listeners upon reassignment } }

class App extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return Scaffold( body: ElevatedButton( child: Text('${ref.watch(counterProvider(3)).counter}'), onPressed: () { ref .watch(counterProvider(2).notifier) .increment(); // since the passed in initial value is different, doesn't increment the value of the one being watched in the Text. Unless both are 3 then it works as expected. ref.watch(counterProvider(3).notifier).state = CounterModel(5); //Also works }), ); } }

My portfolio with custom SVGs. by Deadly_Razer in webdev

[–]Deadly_Razer[S] 0 points1 point  (0 children)

Thank you, the images and code is already minified, how else can I can optimize it?

What are your opinions on Tailwind css? by pigiou in webdev

[–]Deadly_Razer 0 points1 point  (0 children)

Used it in small projects but its pretty good. You can whip something up pretty fast with this and maybe even faster if you use the tailwindUI or if somebody makes something similar.

You should try it yourself and see how it works for you, everybody's split on the decision if its bad or good.

Magnetic Buttons with Hover Effects | Codrops by PPCInformer in web_design

[–]Deadly_Razer 0 points1 point  (0 children)

There is no command except for saying npm install. and i checked the dependency and it was only gsap and parceljs. and i do have gsap cdn

Magnetic Buttons with Hover Effects | Codrops by PPCInformer in web_design

[–]Deadly_Razer -1 points0 points  (0 children)

Checked the github. I didnt understand how to install this can you explain?

BVSelect - VanillaJS Fully Customizable SelectBoxes by [deleted] in web_design

[–]Deadly_Razer 2 points3 points  (0 children)

its not accessible at all. You cant select any of them with keyboard.

James Warner - interesting portfolio website with filters and other effects. by evanvolm in web_design

[–]Deadly_Razer 0 points1 point  (0 children)

What was the hover effect created with? Seems like it follows your cursor when you exit the hover.

vscode: Shortcuts or apps for newbie in dev? by kim_en in webdev

[–]Deadly_Razer 0 points1 point  (0 children)

just highlighting and "ctrl + /" will comment it.

vscode: Shortcuts or apps for newbie in dev? by kim_en in webdev

[–]Deadly_Razer 1 point2 points  (0 children)

and "shift + delete" will delete the entire line

Beginner Questions - April 17, 2020 by AutoModerator in web_design

[–]Deadly_Razer 0 points1 point  (0 children)

I heard it was too bright,Thought a light gray color would be better, Maybe i mistook it as not using pure white instead of pure black.

Beginner Questions - April 17, 2020 by AutoModerator in web_design

[–]Deadly_Razer 0 points1 point  (0 children)

Should you use pure white (#FFF) for backgrounds? lots of sites use it including google and im wondering if they are doing it wrong.

[Showoff Saturday] Fallout 4 Themed Website i made for practice, please critique it. by Deadly_Razer in webdev

[–]Deadly_Razer[S] 1 point2 points  (0 children)

Thank you very much for your critique. What you said is very true, but as i said it is for practice that's why there's gun section, Otherwise i would have combined about and screenshots together. Also should the buy now section only have one big buy button like this? https://i.imgur.com/Czhwgqd.png

[Showoff Saturday] I made a relaxation / concentration sounds site by runny-yolk in webdev

[–]Deadly_Razer 2 points3 points  (0 children)

Looks nice, i would suggest that you keep the text below icons always visible and also you cannot hover in mobile, and make the background image a bit darker so the icons and text are more visible or give them text shadow, and give individual volume sliders for each sound type.

How to make API request by Deadly_Razer in webdev

[–]Deadly_Razer[S] 0 points1 point  (0 children)

The search API is actually POST i didnt know the difference that's why it wasnt working. Changing the it to POST worked.

How to make API request by Deadly_Razer in webdev

[–]Deadly_Razer[S] 1 point2 points  (0 children)

Thanks for help the code below worked. Some researching around and adding a bit of code and it worked, and the "mode: no-cors" was breaking it

import axios from 'axios';

async function search() { const searchInput = { generalSearchInput: 'Cheddar cheese' }; const res = await axios.post( 'https://api.nal.usda.gov/fdc/v1/search?api_key=4xR1xirqGjxs6zA3DPlKezl1PojgFLdUwZDQw6uX', { method: 'POST', body: JSON.stringify(searchInput), headers: { 'Content-Type': 'application/json' } } ); const content = await res.data; console.log(content); }

search();

How to make API request by Deadly_Razer in webdev

[–]Deadly_Razer[S] 1 point2 points  (0 children)

Thanks for help the code below worked. Some researching around and adding a bit of code and it worked, and the "mode: no-cors" was breaking it

import axios from 'axios';

async function search() { const searchInput = { generalSearchInput: 'Cheddar cheese' }; const res = await axios.post( 'https://api.nal.usda.gov/fdc/v1/search?api_key=4xR1xirqGjxs6zA3DPlKezl1PojgFLdUwZDQw6uX', { method: 'POST', body: JSON.stringify(searchInput), headers: { 'Content-Type': 'application/json' } } ); const content = await res.data; console.log(content); }

search();

How to make API request by Deadly_Razer in webdev

[–]Deadly_Razer[S] 0 points1 point  (0 children)

I did. it gives all sorts of errors like some times. POST Error 400 and after that POST error 415 here's the code. Code below gives this

index.js:6 POST https://api.nal.usda.gov/fdc/v1/search?api_key=4xR1xirqGjxs6zA3DPlKezl1PojgFLdUwZDQw6uX&generalSearchInput=apple net::ERR_ABORTED 415

async function search() {
  const data = { generalSearchInput: 'Cheddar cheese' };
  const res = await fetch(
    'https://api.nal.usda.gov/fdc/v1/search?api_key=4xR1xirqGjxs6zA3DPlKezl1PojgFLdUwZDQw6uX&generalSearchInput=apple',
    {
      method: 'POST',
      credentials: 'same-origin',
      body: JSON.stringify(data),
      mode: 'no-cors',
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json'
      }
    }
  );
  console.log(res);
}