Skip to content

Commit

Permalink
refactor: sort
Browse files Browse the repository at this point in the history
  • Loading branch information
omartinma committed Feb 8, 2024
1 parent 49bae43 commit 4ee24ef
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/basics/basics_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
Expand Down
9 changes: 2 additions & 7 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ie_workshop/basics/basics_screen.dart';
import 'package:ie_workshop/sample_app/bloc/sample_bloc.dart';

void main() {
runApp(const MainApp());
Expand All @@ -12,11 +10,8 @@ class MainApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return MaterialApp(
home: BlocProvider(
create: (context) => SampleBloc()..add(const FetchData()),
child: const BasicsScreen(),
),
return const MaterialApp(
home: BasicScreenView(),
);
}
}
36 changes: 24 additions & 12 deletions lib/sample_app/sample_app_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ie_workshop/sample_app/bloc/sample_bloc.dart';

class MyItem {
MyItem({
required this.name,
required this.description,
required this.url,
});
class SampleAppScreen extends StatelessWidget {
const SampleAppScreen({super.key});

final String name;
final String description;
final String url;
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => SampleBloc()..add(const FetchData()),
child: const SampleAppScreenView(),
);
}
}

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

@override
Widget build(BuildContext context) {
Expand All @@ -36,7 +36,7 @@ class SampleAppScreen extends StatelessWidget {
style: const TextStyle(fontSize: 24),
),
leading: Image.network(item.url),
trailing: const Icon(Icons.account_tree_sharp),
trailing: const Icon(Icons.arrow_forward_ios),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute<void>(
Expand Down Expand Up @@ -73,3 +73,15 @@ class DetailsScreen extends StatelessWidget {
);
}
}

class MyItem {
MyItem({
required this.name,
required this.description,
required this.url,
});

final String name;
final String description;
final String url;
}

0 comments on commit 4ee24ef

Please sign in to comment.