포스트

chatgpt로 simple flutter code 만들기(5)

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
void _showSettingsDialog(BuildContext context, WidgetRef ref) {
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return AlertDialog(
        title: Center(child: Text('App Settings')), // Center the title
        content: SingleChildScrollView(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              // Container for app data info
              _buildSettingsContainer(
                // Stretch the container
                width: double.infinity,
                child: ... // Content of the container
              ),
              
              // Other containers...
              
              // Container for "Use in-app browser view" toggle
              _buildSettingsContainer(
                width: double.infinity, // Stretch the container
                child: ... // Content of the container
              ),
            ],
          ),
        ),
        // Other properties such as actions...
      );
    },
  );
}

// Updated helper method for creating containers
Widget _buildSettingsContainer({required Widget child, double? width}) {
  return Container(
    width: width, // Use provided width
    padding: EdgeInsets.all(8),
    margin: EdgeInsets.only(top: 8),
    decoration: BoxDecoration(
      border: Border.all(color: Colors.grey),
      borderRadius: BorderRadius.circular(8),
    ),
    child: child,
  );
}

[영상]

https://gist.github.com/southglory/cb84f738771701da77b51d6a73b71a6a/revisions

이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.