Files
adventofcode2025/lib/day_page.dart

63 lines
1.6 KiB
Dart

import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
Future<void> selectFile() async {
print("Button Pushed");
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) {
//File file = File(result.files.single.path!);
print(result.files.single.path!);
} else {
// User canceled the picker
}
}
class DayPage extends StatelessWidget {
const DayPage({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: [
Row(
children: [
TextButton(onPressed: selectFile, child: Text("Select Input")),
SizedBox(
width: 300,
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'Input File Path',
),
),
),
],
),
Row(
children: [TextButton(onPressed: selectFile, child: Text("Run"))],
),
Expanded(
child: Row(
children: [
Expanded(
child: TextField(
decoration: InputDecoration(border: OutlineInputBorder()),
readOnly: true,
expands: true,
minLines: null,
maxLines: null,
),
),
],
),
),
],
),
);
}
}