callerkit/lib/main.dart

47 lines
1007 B
Dart
Raw Normal View History

2023-08-24 08:28:28 +00:00
import 'package:english_words/english_words.dart';
2023-08-23 05:12:23 +00:00
import 'package:flutter/material.dart';
2023-08-24 08:28:28 +00:00
import 'package:provider/provider.dart';
2023-08-23 05:12:23 +00:00
void main() {
2023-08-24 08:28:28 +00:00
runApp(MyApp());
2023-08-23 05:12:23 +00:00
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
2023-08-24 08:28:28 +00:00
return ChangeNotifierProvider(
create: (context) => MyAppState(),
child: MaterialApp(
title: 'Namer App',
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
),
home: MyHomePage(),
2023-08-23 05:12:23 +00:00
),
);
}
}
2023-08-24 08:28:28 +00:00
class MyAppState extends ChangeNotifier {
var current = WordPair.random();
2023-08-23 05:12:23 +00:00
}
2023-08-24 08:28:28 +00:00
class MyHomePage extends StatelessWidget {
2023-08-23 05:12:23 +00:00
@override
Widget build(BuildContext context) {
2023-08-24 08:28:28 +00:00
var appState = context.watch<MyAppState>();
2023-08-23 05:12:23 +00:00
return Scaffold(
2023-08-24 08:28:28 +00:00
body: Column(
children: [
Text('A random idea:'),
Text(appState.current.asLowerCase),
],
2023-08-23 05:12:23 +00:00
),
);
}
}