Navaron Bracke

remove the builder from the controller sample

@@ -50,54 +50,49 @@ class _BarcodeScannerWithControllerState @@ -50,54 +50,49 @@ class _BarcodeScannerWithControllerState
50 return Scaffold( 50 return Scaffold(
51 appBar: AppBar(title: const Text('With controller')), 51 appBar: AppBar(title: const Text('With controller')),
52 backgroundColor: Colors.black, 52 backgroundColor: Colors.black,
53 - body: Builder(  
54 - builder: (context) {  
55 - return Stack(  
56 - children: [  
57 - MobileScanner(  
58 - controller: controller,  
59 - errorBuilder: (context, error, child) {  
60 - return ScannerErrorWidget(error: error);  
61 - },  
62 - fit: BoxFit.contain,  
63 - ),  
64 - Align(  
65 - alignment: Alignment.bottomCenter,  
66 - child: Container(  
67 - alignment: Alignment.bottomCenter,  
68 - height: 100,  
69 - color: Colors.black.withOpacity(0.4),  
70 - child: Row(  
71 - mainAxisAlignment: MainAxisAlignment.spaceEvenly,  
72 - children: [  
73 - ToggleFlashlightButton(controller: controller),  
74 - StartStopMobileScannerButton(controller: controller),  
75 - Center(  
76 - child: SizedBox(  
77 - width: MediaQuery.of(context).size.width - 200,  
78 - height: 50,  
79 - child: FittedBox(  
80 - child: Text(  
81 - barcode?.barcodes.first.rawValue ??  
82 - 'Scan something!',  
83 - overflow: TextOverflow.fade,  
84 - style: Theme.of(context)  
85 - .textTheme  
86 - .headlineMedium!  
87 - .copyWith(color: Colors.white),  
88 - ),  
89 - ), 53 + body: Stack(
  54 + children: [
  55 + MobileScanner(
  56 + controller: controller,
  57 + errorBuilder: (context, error, child) {
  58 + return ScannerErrorWidget(error: error);
  59 + },
  60 + fit: BoxFit.contain,
  61 + ),
  62 + Align(
  63 + alignment: Alignment.bottomCenter,
  64 + child: Container(
  65 + alignment: Alignment.bottomCenter,
  66 + height: 100,
  67 + color: Colors.black.withOpacity(0.4),
  68 + child: Row(
  69 + mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  70 + children: [
  71 + ToggleFlashlightButton(controller: controller),
  72 + StartStopMobileScannerButton(controller: controller),
  73 + Center(
  74 + child: SizedBox(
  75 + width: MediaQuery.of(context).size.width - 200,
  76 + height: 50,
  77 + child: FittedBox(
  78 + child: Text(
  79 + barcode?.barcodes.first.rawValue ?? 'Scan something!',
  80 + overflow: TextOverflow.fade,
  81 + style: Theme.of(context)
  82 + .textTheme
  83 + .headlineMedium!
  84 + .copyWith(color: Colors.white),
90 ), 85 ),
91 ), 86 ),
92 - SwitchCameraButton(controller: controller),  
93 - AnalyzeImageFromGalleryButton(controller: controller),  
94 - ], 87 + ),
95 ), 88 ),
96 - ), 89 + SwitchCameraButton(controller: controller),
  90 + AnalyzeImageFromGalleryButton(controller: controller),
  91 + ],
97 ), 92 ),
98 - ],  
99 - );  
100 - }, 93 + ),
  94 + ),
  95 + ],
101 ), 96 ),
102 ); 97 );
103 } 98 }