basic structure with material 3

This commit is contained in:
Tito Arrigo
2023-09-27 13:24:31 +02:00
committed by Joe Küng
parent ce1e5223f0
commit 4d898eb5ea
3 changed files with 37 additions and 3 deletions

View File

@@ -6,8 +6,12 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return MaterialApp(
title: 'My App', title: 'My App',
theme: ThemeData(
useMaterial3: true,
primaryColor: Colors.red,
),
home: Navigation() home: Navigation()
); );
} }

View File

@@ -1,6 +1,7 @@
import 'dart:ffi'; import 'dart:ffi';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'testUI.dart';
class Navigation extends StatefulWidget { class Navigation extends StatefulWidget {
const Navigation({super.key}); const Navigation({super.key});
@@ -11,9 +12,9 @@ class Navigation extends StatefulWidget {
class _NavigationState extends State<Navigation> { class _NavigationState extends State<Navigation> {
int _selectedIndex = 1; int _selectedIndex = 0;
static const List<Widget> _widgetOptions = <Widget>[ static const List<Widget> _widgetOptions = <Widget>[
Text("Calendar"), TestUI(),
Text("Inbox"), Text("Inbox"),
Text("Notes"), Text("Notes"),
]; ];

29
lib/testUI.dart Normal file
View File

@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
class TestUI extends StatefulWidget {
const TestUI({super.key});
@override
State<TestUI> createState() => _TestUIState();
}
class _TestUIState extends State<TestUI> {
int _test = 0;
void _onPressed() {
setState(() {
_test = 1;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(children: [
FloatingActionButton(onPressed: _onPressed),
Text('$_test'),
],),
),
);
}
}