-2
/this is slider from settings

value: sliderValue ??= 125,
label: sliderValue.toString(),
divisions: 23,
onChanged: (newValue) {
setState(
() => sliderValue = newValue,
);

                          },

//this is container in homepage
 Container(
    width: MediaQuery.of(context).size.width,
    height: MediaQuery.of(context).size.height * 0.858,
    decoration: BoxDecoration(
    color: Color(0xFFEEEEEE),

how can i change the color of container, and secondary color of the app based on slider value?

Hesam Rasoulian
  • 1,356
  • 3
  • 12
  • 18
bird
  • 1
  • 2

2 Answers2

1

You can use one of the state managements methods for variable passing between pages like provider or bloc.

More beginner and easy way for this is passing a variable to the widget you need to use with that variable.

For example:

class ProjectPage extends StatefulWidget {
  final String? variable_one;
  final int? variable_two;

  const ProjectPage({super.key, this.variable_one, this.variable_two});

  @override
  _ProjectPageState createState() => _ProjectPageState();
}
batuhand
  • 475
  • 3
  • 11
0

use Provider Package to create a global variable which can be accessible from anywhere in the code

AHMAD_AR
  • 76
  • 1
  • 7