119 lines
3.8 KiB
Dart
119 lines
3.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'models/mini_app.dart';
|
|
import 'screens/news_screen.dart';
|
|
import 'screens/notes_screen.dart';
|
|
import 'screens/currency_screen.dart';
|
|
import 'screens/crypto_screen.dart';
|
|
import 'screens/dino_screen.dart';
|
|
import 'screens/memory_screen.dart';
|
|
import 'screens/minesweeper_screen.dart';
|
|
import 'screens/calculator_screen.dart';
|
|
|
|
void main() {
|
|
runApp(const CarteiraAppsApp());
|
|
}
|
|
|
|
class CarteiraAppsApp extends StatelessWidget {
|
|
const CarteiraAppsApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Carteira Apps',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
|
|
useMaterial3: true,
|
|
),
|
|
home: const HomePage(),
|
|
routes: {
|
|
'/news': (context) => const NewsScreen(),
|
|
'/notes': (context) => const NotesScreen(),
|
|
'/currency': (context) => const CurrencyScreen(),
|
|
'/crypto': (context) => const CryptoScreen(),
|
|
'/dino': (context) => const DinoScreen(),
|
|
'/memory': (context) => const MemoryScreen(),
|
|
'/minesweeper': (context) => const MinesweeperScreen(),
|
|
'/calculator': (context) => const CalculatorScreen(),
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
class HomePage extends StatelessWidget {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Carteira Apps'),
|
|
centerTitle: true,
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(12.0),
|
|
child: Column(
|
|
children: [
|
|
// Search bar
|
|
TextField(
|
|
decoration: InputDecoration(
|
|
hintText: 'Pesquisar apps...',
|
|
prefixIcon: const Icon(Icons.search),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
filled: true,
|
|
fillColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
// Grid of mini apps
|
|
Expanded(
|
|
child: GridView.builder(
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 2,
|
|
crossAxisSpacing: 12,
|
|
mainAxisSpacing: 12,
|
|
childAspectRatio: 0.9,
|
|
),
|
|
itemCount: miniApps.length,
|
|
itemBuilder: (context, index) {
|
|
final app = miniApps[index];
|
|
return Card(
|
|
elevation: 2,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(16),
|
|
onTap: () {
|
|
// Navigate to the named route
|
|
Navigator.of(context).pushNamed(app.route);
|
|
},
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(
|
|
app.icon,
|
|
size: 48,
|
|
color: app.color,
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
app.title,
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|