File size: 1,627 Bytes
3382f47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import 'package:auto_gpt_flutter_client/constants/app_colors.dart';
import 'package:flutter/material.dart';

class LeaderboardSubmissionButton extends StatelessWidget {
  final VoidCallback? onPressed;
  final bool isDisabled;

  LeaderboardSubmissionButton(
      {required this.onPressed, this.isDisabled = false});

  @override
  Widget build(BuildContext context) {
    final button = SizedBox(
      height: 50,
      child: ElevatedButton(
        style: ElevatedButton.styleFrom(
          backgroundColor: isDisabled ? Colors.grey : AppColors.primaryLight,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(8.0),
          ),
          padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
          elevation: 5.0,
        ),
        onPressed: isDisabled ? null : onPressed,
        child: const Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              'Submit to leaderboard',
              style: TextStyle(
                color: Colors.white,
                fontSize: 12.50,
                fontFamily: 'Archivo',
                fontWeight: FontWeight.w400,
              ),
            ),
            SizedBox(width: 10),
            Icon(
              Icons.emoji_events,
              color: Colors.white,
              size: 24,
            ),
          ],
        ),
      ),
    );

    return isDisabled
        ? Tooltip(
            message:
                "You must complete a test suite before submitting to the leaderboard.",
            child: button,
          )
        : button;
  }
}