前提
ログイン画面を作成しているのですが、利用規約(TextButtonウィジェット)とプライバシーポリシー(TextButtonウィジェット)同士がどうしても離れてしまします。
ネットで調べたのですが、余白を開ける方法や、画面の端につめるなどの方法しか見つからず、二つのウィジェットの位置を詰める(近づける)方法はわからなかったので質問させていただきます。
アドバイスいただけたら幸いです。
該当のソースコード
Dart
1import 'package:ex_diary/new_account.dart'; 2import 'package:ex_diary/privacy_policy.dart'; 3import 'package:ex_diary/terms_of_use.dart'; 4import 'package:flutter/material.dart'; 5import 'login.dart'; 6 7void main() async { 8 runApp( 9 MaterialApp( 10 home: MyApp(), 11 ), 12 ); 13} 14 15class MyApp extends StatefulWidget { 16 const MyApp({Key? key}); 17 18 State<MyApp> createState() => LoginTransit(); 19} 20 21class LoginTransit extends State<MyApp> { 22 23 Widget build(BuildContext context) { 24 final double deviceHeight = MediaQuery.of(context).size.height; 25 return Scaffold( 26 backgroundColor: Colors.orangeAccent, 27 body: Center( 28 child: Column( 29 children: <Widget>[ 30 SizedBox( 31 height: deviceHeight * 0.3, 32 ), 33 Container( 34 alignment: Alignment.center, 35 child: Text('タイトルへようこそ'), 36 ), 37 SizedBox( 38 height: deviceHeight * 0.2, 39 ), 40 Container( 41 child: TextButton( 42 child: Text("アカウント作成"), 43 onPressed: () { 44 // ログイン画面へ 45 Navigator.push(context, 46 MaterialPageRoute(builder: (context) => NewAccount())); 47 }, 48 ), 49 ), 50 // SizedBox( 51 // height: deviceHeight * 0.1, 52 // ), 53 Container( 54 child: TextButton( 55 child: Text("ログイン"), 56 onPressed: () { 57 // ログイン画面へ 58 Navigator.push(context, 59 MaterialPageRoute(builder: (context) => login())); 60 }, 61 ), 62 ), 63 SizedBox( 64 height: deviceHeight * 0.2, 65 ), 66 const Divider(height: 0), 67 TextButton( 68 child: Text( 69 "利用規約", 70 style: TextStyle( 71 decoration: TextDecoration.underline, 72 ), 73 ), 74 onPressed: () { 75 // 利用規約画面へ 76 Navigator.push(context, 77 MaterialPageRoute(builder: (context) => TermsOfUse())); 78 }, 79 ), 80 TextButton( 81 child: Text( 82 "プライバシーポリシー", 83 style: TextStyle( 84 decoration: TextDecoration.underline, 85 ), 86 ), 87 onPressed: () { 88 // プライバシーポリシー画面へ 89 Navigator.push(context, 90 MaterialPageRoute(builder: (context) => PrivacyPolicy())); 91 }, 92 ), 93 ], 94 ), 95 ), 96 ); 97 } 98} 99
試したこと
・styleFormでminimumISizeを設定
・Positioned
・Align
補足情報(FW/ツールのバージョンなど)
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-arm, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.0)

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/11/19 04:11