Skip to content
On this page

Use Query

Use to adapt styling property to MediaQuery.

        (v, query) => v..color =

    ..useQuery((v, query) => =;

This will adapt the style to Query you conditional return.

    ..size = [100, 100]
    ..useQuery((v, query) {
        if(query.platformBrightness == Brightness.dark)
            return = Colors.gray.shade700
            return = Colors.gray.shade100

Best Practice

  • If you want to get device theme, then use useThemeSelector instead.
  • If you're trying to get device screen size, then use useSize instead.
  • If you want to use predefined screen size, then use useScreen instead.
  • If you're detecting platform specific UI, then use usePlatform instead.