質問内容
containerに下線をつけたいです。
しかし、ネットで調べても線の太さを調整する方法は出てくるのですが、線自体の幅を調整する方法が出てこず、質問させていただきました。
どなたか教えていただけないでしょうか?
該当のソースコード
Dart
1import 'package:flutter/material.dart'; 2import 'package:flutter/cupertino.dart'; 3 4class PushNotification extends StatefulWidget { 5 const PushNotification({Key? key}) : super(key: key); 6 7 State<PushNotification> createState() => _PushNotification(); 8} 9 10class _PushNotification extends State<PushNotification> { 11 bool _isOn1 = true; 12 bool _isOn2 = true; 13 bool _isOn3 = true; 14 bool _isOn4 = true; 15 bool _isOn5 = true; 16 bool _isOn6 = true; 17 18 19 Widget build(BuildContext context) { 20 final double deviceHeight = MediaQuery.of(context).size.height; 21 final double devicewWdth = MediaQuery.of(context).size.width; 22 return Scaffold( 23 backgroundColor: Color.fromARGB(255, 243, 243, 243), 24 appBar: PreferredSize( 25 preferredSize: Size.fromHeight(70), 26 child: AppBar( 27 iconTheme: IconThemeData(color: Colors.black, size: 23), 28 leadingWidth: devicewWdth * 0.2, 29 backgroundColor: Color.fromARGB(255, 243, 243, 243), 30 elevation: 0.0, 31 centerTitle: true, 32 title: Text('プッシュ通知', 33 style: TextStyle( 34 fontWeight: FontWeight.w600, 35 fontSize: 14, 36 color: Colors.black)), 37 bottom: PreferredSize( 38 child: Container( 39 height: 0.3, 40 color: Color.fromARGB(255, 156, 156, 156), 41 ), 42 preferredSize: Size.fromHeight(5)), 43 ), 44 ), 45 body: Center( 46 child: Container( 47 color: Color.fromARGB(255, 243, 243, 243), 48 child: Column( 49 children: <Widget>[ 50 Container( 51 height: deviceHeight * 0.08, 52 width: devicewWdth, 53 decoration: BoxDecoration( 54 border: Border( 55 bottom: BorderSide( 56 color: Color.fromARGB(255, 156, 156, 156), 57 width: 0.3, 58 ), 59 ), 60 color: Colors.white, 61 ), 62 child: Row( 63 mainAxisAlignment: MainAxisAlignment.spaceBetween, 64 children: <Widget>[ 65 Row( 66 children: const <Widget>[ 67 Text('スイッチ'), 68 ], 69 ), 70 CupertinoSwitch( 71 value: _isOn1, 72 onChanged: (bool? value) => 73 setState(() => _isOn1 = value!), 74 ), 75 ], 76 ), 77 ), 78 ], 79 ), 80 ), 81 ), 82 ); 83 } 84} 85 86
補足情報(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)
回答4件
あなたの回答
tips
プレビュー