Skip to content

Commit

Permalink
componentizing widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcostab committed Jun 2, 2023
1 parent 3050762 commit 3714d4f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 33 deletions.
23 changes: 23 additions & 0 deletions lib/home_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';

class HomePage extends StatelessWidget{
const HomePage({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
body: const Center(
child: Text('Flutterando'),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {
debugPrint('Clicou');
},
),
);
}
}
34 changes: 1 addition & 33 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,38 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hello_world/myapp.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context){
return const MaterialApp(
home: HomeWidget(),
);
}
}

class HomeWidget extends StatelessWidget{
const HomeWidget({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
body: const Center(
child: Text('Flutterando'),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {
debugPrint('Clicou');
},
),
);
}
}
14 changes: 14 additions & 0 deletions lib/myapp.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';

import 'home_page.dart';

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context){
return const MaterialApp(
home: HomePage(),
);
}
}

0 comments on commit 3714d4f

Please sign in to comment.