creek

The AI Image Editor of 2030

lib/ui/widgets/secondary_button.dart (1393B)


 1import 'package:flutter/material.dart';
 2import 'package:creekui/ui/styles/variables.dart';
 3
 4class SecondaryButton extends StatelessWidget {
 5  final String text;
 6  final VoidCallback? onPressed;
 7  final bool isLoading;
 8
 9  const SecondaryButton({
10    super.key,
11    required this.text,
12    this.onPressed,
13    this.isLoading = false,
14  });
15
16  @override
17  Widget build(BuildContext context) {
18    return SizedBox(
19      width: double.infinity,
20      child: ElevatedButton(
21        onPressed: isLoading ? null : onPressed,
22        style: ElevatedButton.styleFrom(
23          backgroundColor: Variables.borderSubtle,
24          foregroundColor: Variables.textPrimary,
25          padding: const EdgeInsets.symmetric(vertical: 12),
26          shape: RoundedRectangleBorder(
27            borderRadius: BorderRadius.circular(100),
28          ),
29          elevation: 0,
30        ),
31        child:
32            isLoading
33                ? const SizedBox(
34                  height: 20,
35                  width: 20,
36                  child: CircularProgressIndicator(
37                    color: Variables.textPrimary,
38                    strokeWidth: 2,
39                  ),
40                )
41                : Text(
42                  text,
43                  style: Variables.buttonTextStyle.copyWith(
44                    color: Variables.textPrimary,
45                  ),
46                ),
47      ),
48    );
49  }
50}