Move flutter app into root of repo

This commit is contained in:
2026-02-20 19:44:40 -06:00
parent 9f0342ba1a
commit 5f43ff3d4c
138 changed files with 262 additions and 759 deletions

12
lib/days_enum.dart Normal file
View File

@@ -0,0 +1,12 @@
enum AdventOfCodeDays {
day1(title: "Day 1"),
day2(title: "Day 2"),;
const AdventOfCodeDays({
required this.title
});
final String title;
}

103
lib/main.dart Normal file
View File

@@ -0,0 +1,103 @@
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'days_enum.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => MyAppState(),
child: MaterialApp(
title: 'Advent of Code 2025',
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
),
home: MyHomePage(),
),
);
}
}
class MyAppState extends ChangeNotifier {
}
class MyHomePage extends StatefulWidget {
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
var selectedIndex = 0;
@override
Widget build(BuildContext context) {
// Manage days and create items list of a pages.
final days = [AdventOfCodeDays.day1, AdventOfCodeDays.day2];
List<NavigationRailDestination> dayItems = [];
for (var day in days) {
dayItems.add(
NavigationRailDestination(
icon: Icon(Icons.arrow_forward_ios),
label: Text(day.title),
),
);
}
var colorScheme = Theme.of(context).colorScheme;
Widget page = DayPage();
// The container for the current page, with its background color
// and subtle switching animation.
var mainArea = ColoredBox(
color: colorScheme.surfaceContainerHighest,
child: AnimatedSwitcher(
duration: Duration(milliseconds: 200),
child: page,
),
);
return Scaffold(
body: LayoutBuilder(
builder: (context, constraints) {
return Row(
children: [
SafeArea(
child: NavigationRail(
extended: constraints.maxWidth >= 600,
destinations: dayItems,
selectedIndex: selectedIndex,
onDestinationSelected: (value) {
setState(() {
selectedIndex = value;
});
},
),
),
Expanded(child: mainArea),
],
);
},
),
);
}
}
class DayPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(children: [SizedBox(width: 10)]),
],
);
}
}