import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:http/http.dart' as http;

class FilterBtn extends HookWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build

    // Future<void> generateExport() async {
    //   // API endpoint to download the Excel file
    //
    //   // Send GET request to the API
    //   var url = Uri.parse(Environment.apiUrl +
    //       'exportDataByClientPolicyId?client_id=$clintID&client_policy_id=62');
    //
    //   var response = await http.get(
    //     url,
    //     headers: {
    //       'Authorization': 'Bearer $_token',
    //     },
    //   );
    //
    //   if (response.statusCode == 200) {
    //     // Create a blob from the response body
    //     final blob = html.Blob([response.bodyBytes]);
    //
    //     // Generate a download URL for the blob
    //     final url = html.Url.createObjectUrlFromBlob(blob);
    //
    //     // Create a link element to trigger the download
    //     final anchor = html.AnchorElement(href: url)
    //       ..setAttribute('download', 'excel_file.xlsx')
    //       ..click();
    //
    //     // Revoke the download URL to free up resources
    //     html.Url.revokeObjectUrl(url);
    //   } else {
    //     // Handle error
    //     print('Failed to download Excel file: ${response.statusCode}');
    //   }
    // }

    return GestureDetector(
      onTap: () {
        print('Filter');
        // generateExport();
      },
      child: Container(
        padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 11.5),
        decoration: BoxDecoration(
          color: Color(0xFFF6F8F8),
          borderRadius: BorderRadius.circular(8.0),
        ),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            Text(
              'Filter',
              style: TextStyle(
                color: Color(0xFF686868),
                fontWeight: FontWeight.w500,
                fontSize: 16,
              ),
            ),
            SizedBox(width: 20),
            Icon(Icons.filter_list_sharp, color: Color(0xFF686868)),
          ],
        ),
      ),
    );
  }
}
