Navaron Bracke

remove builder from the zoom slider example

@@ -91,59 +91,55 @@ class _BarcodeScannerWithZoomState extends State<BarcodeScannerWithZoom> @@ -91,59 +91,55 @@ class _BarcodeScannerWithZoomState extends State<BarcodeScannerWithZoom>
91 return Scaffold( 91 return Scaffold(
92 appBar: AppBar(title: const Text('With zoom slider')), 92 appBar: AppBar(title: const Text('With zoom slider')),
93 backgroundColor: Colors.black, 93 backgroundColor: Colors.black,
94 - body: Builder(  
95 - builder: (context) {  
96 - return Stack(  
97 - children: [  
98 - MobileScanner(  
99 - controller: controller,  
100 - fit: BoxFit.contain,  
101 - errorBuilder: (context, error, child) {  
102 - return ScannerErrorWidget(error: error);  
103 - },  
104 - ),  
105 - Align(  
106 - alignment: Alignment.bottomCenter,  
107 - child: Container(  
108 - alignment: Alignment.bottomCenter,  
109 - height: 100,  
110 - color: Colors.black.withOpacity(0.4),  
111 - child: Column( 94 + body: Stack(
  95 + children: [
  96 + MobileScanner(
  97 + controller: controller,
  98 + fit: BoxFit.contain,
  99 + errorBuilder: (context, error, child) {
  100 + return ScannerErrorWidget(error: error);
  101 + },
  102 + ),
  103 + Align(
  104 + alignment: Alignment.bottomCenter,
  105 + child: Container(
  106 + alignment: Alignment.bottomCenter,
  107 + height: 100,
  108 + color: Colors.black.withOpacity(0.4),
  109 + child: Column(
  110 + children: [
  111 + _buildZoomScaleSlider(),
  112 + Row(
  113 + mainAxisAlignment: MainAxisAlignment.spaceEvenly,
112 children: [ 114 children: [
113 - _buildZoomScaleSlider(),  
114 - Row(  
115 - mainAxisAlignment: MainAxisAlignment.spaceEvenly,  
116 - children: [  
117 - ToggleFlashlightButton(controller: controller),  
118 - StartStopMobileScannerButton(controller: controller),  
119 - Center(  
120 - child: SizedBox(  
121 - width: MediaQuery.of(context).size.width - 200,  
122 - height: 50,  
123 - child: FittedBox(  
124 - child: Text(  
125 - barcode?.barcodes.first.rawValue ??  
126 - 'Scan something!',  
127 - overflow: TextOverflow.fade,  
128 - style: Theme.of(context)  
129 - .textTheme  
130 - .headlineMedium!  
131 - .copyWith(color: Colors.white),  
132 - ),  
133 - ), 115 + ToggleFlashlightButton(controller: controller),
  116 + StartStopMobileScannerButton(controller: controller),
  117 + Center(
  118 + child: SizedBox(
  119 + width: MediaQuery.of(context).size.width - 200,
  120 + height: 50,
  121 + child: FittedBox(
  122 + child: Text(
  123 + barcode?.barcodes.first.rawValue ??
  124 + 'Scan something!',
  125 + overflow: TextOverflow.fade,
  126 + style: Theme.of(context)
  127 + .textTheme
  128 + .headlineMedium!
  129 + .copyWith(color: Colors.white),
134 ), 130 ),
135 ), 131 ),
136 - SwitchCameraButton(controller: controller),  
137 - AnalyzeImageFromGalleryButton(controller: controller),  
138 - ], 132 + ),
139 ), 133 ),
  134 + SwitchCameraButton(controller: controller),
  135 + AnalyzeImageFromGalleryButton(controller: controller),
140 ], 136 ],
141 ), 137 ),
142 - ), 138 + ],
143 ), 139 ),
144 - ],  
145 - );  
146 - }, 140 + ),
  141 + ),
  142 + ],
147 ), 143 ),
148 ); 144 );
149 } 145 }