import 'dart:io';

import 'package:flutter/material.dart';
import 'package:project_manager/utils/api/documents.dart';

class UploadExcelScreen extends StatefulWidget {
  const UploadExcelScreen({super.key});

  @override
  UploadExcelScreenState createState() => UploadExcelScreenState();
}

class UploadExcelScreenState extends State<UploadExcelScreen> {

  File? _document;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Upload Document')),
      body: Column(
        children: [
          const SizedBox(height: 20),
          ElevatedButton(
            onPressed: () async => {
              _document = await Documents.pickDocument()
            },
            child: Text('Pick Document'),
          ),
          const SizedBox(height: 20),
          ElevatedButton(
            onPressed: () => {
              Documents.uploadDocument(_document)
            },
            child: const Text('Upload Document'),
          ),
        ],
      ),
    );
  }
}