Tout est en StateFulWidget
Pour le TabController :
class _InfosPanelState extends State<InfosPanel> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: DefaultTabController(
length: 3,
child: Scaffold(
appBar: NewGradientAppBar(
gradient: LinearGradient(colors: [black, grey30, black]),
centerTitle: true,
title: const ImageIcon(
AssetImage('assets/logo/logo_simple.png'),
size: 80,
color: Color.fromRGBO(0, 100, 203, 1),
),
bottom: TabBar(indicatorColor: blue, tabs: const [
Tab(
icon: Icon(
Icons.info_outlined,
color: Colors.white,
)),
Tab(icon: Icon(Icons.thermostat, color: Colors.white)),
Tab(icon: Icon(Icons.lightbulb_outlined, color: Colors.white)),
]),
),
body: const TabBarView(children: [
Center(child: Infos()),
Center(child: Thermostat()),
Center(child: Light()),
]),
),
),
);
}
}
Pour la 1ère page par exemple :
class _InfosState extends State<Infos> {
@override
Widget build(BuildContext context) {
return Container(
color: black,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 350,
child: Image.asset('assets/images/lignebleue.png'),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 72,
height: 48,
child: Image.asset('assets/images/int.png'),
),
const SizedBox(
width: 256,
height: 48,
child: Center(
child: Text(
"23.5°c - 77%",
style: TextStyle(color: Colors.white70, fontSize: 24),
textAlign: TextAlign.center,
),
),
)
],
),
SizedBox(
width: 350,
child: Image.asset('assets/images/lignebleue.png'),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 72,
height: 48,
child: Image.asset('assets/images/ext.png'),
),
const SizedBox(
width: 256,
height: 48,
child: Center(
child: Text(
"23.5°c - 77%",
style: TextStyle(color: Colors.white70, fontSize: 24),
textAlign: TextAlign.center,
),
),
)
],
),
SizedBox(
width: 350,
child: Image.asset('assets/images/lignebleue.png'),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 72,
height: 48,
child: Image.asset('assets/images/panel.png'),
),
const SizedBox(
width: 256,
height: 48,
child: Center(
child: Text(
"23.5°c - 77%",
style: TextStyle(color: Colors.white70, fontSize: 24),
textAlign: TextAlign.center,
),
),
)
],
),
SizedBox(
width: 350,
child: Image.asset('assets/images/lignebleue.png'),
),
],
),
);
}
}
le Doctor dit:
PS D:\dev\epsat_aer\aer> flutter doctor -v
[√] Flutter (Channel master, 2.11.0-0.0.pre.632, on Microsoft Windows [version 10.0.17763.2565], locale fr-FR)
• Flutter version 2.11.0-0.0.pre.632 at D:\DOCUMENTS\flutter
• Upstream repository GitHub - flutter/flutter: Flutter makes it easy and fast to build beautiful apps for mobile and beyond
• Framework revision c849844feb (2 days ago), 2022-02-19 01:54:16 -0500
• Engine revision f6ea6186ee
• Dart version 2.17.0 (build 2.17.0-125.0.dev)
• DevTools version 2.11.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\PC_BUREAU\AppData\Local\Android\sdk
• Platform android-32, build-tools 31.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at Download Visual Studio Tools - Install Free for Windows, Mac, Linux.
Please install the « Desktop development with C++ » workload, including all of its default components
[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[√] VS Code (version 1.64.2)
• VS Code at C:\Users\PC_BUREAU\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.34.0
[√] Connected device (3 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [version 10.0.17763.2565]
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.102
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Tout fonctionne bien en émulateur et une fois sur 10 en release en gros.