Created
May 19, 2022 10:55
-
-
Save Zujaj/5fccee32e562b77eeb89f0434d67e550 to your computer and use it in GitHub Desktop.
The Home Widget.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
import 'package:svg_colorization/providers/previous_color.dart'; | |
import 'package:svg_colorization/providers/svg_data.dart'; | |
import 'package:svg_colorization/widgets/scene_renderer.dart'; | |
import 'package:svg_colorization/widgets/slider_options.dart'; | |
class Home extends StatelessWidget { | |
const Home({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
/// Holds the [SVData] object. | |
final svg = context.read<SVGData>(); | |
/// Holds the [PreviousColor] object. | |
final previousColor = context.read<PreviousColor>(); | |
return Scaffold( | |
body: Column( | |
children: [ | |
const SceneRenderer(), | |
Expanded( | |
child: SliderOptions( | |
onColorSelected: (String hexColor) { | |
// Replace the svg previous color value with the current [hexColor]. | |
svg.updateCode(previousColor.value, hexColor); | |
// Update the previous color [value]. | |
previousColor.updateValue(hexColor); | |
}, | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment