例如:有关问题的详细信息。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。我想让三个单词(文本(在中间垂直对齐。当我尝试这个无法显示三个单词垂直居中。我试过一个单词可以很好地显示,但当我尝试三个单词时,无法显示。下面我附上了一张图片供参考。我想像这样显示详细信息页面
详细信息页面:
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:odia_rasiphala/HomePage.dart';
import 'dart:convert';
class DetailsPage extends StatelessWidget {
const DetailsPage({Key? key, required this.title, required this.main_img, required this.content}) : super(key: key);
// Declare a field that holds the strings passed to this class.
final String title;
final String main_img;
final String content;
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
child: new Scaffold(
appBar: new AppBar(
title: new Text('ଆଜିର ରାଶିଫଳ'),
leading: new IconButton(
icon: new Icon(Icons.arrow_back_outlined),
onPressed: () => Navigator.pushReplacement(context,
new MaterialPageRoute(builder: (context) => HomePage())),
),
actions: [
IconButton(
onPressed: () {},
icon: Icon(Icons.share),
),
],
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Image.network(
main_img,
width: 200.0,
height: 200.0,
),
new Center(
child: new Text(title,
style: TextStyle(color: Colors.black, fontSize: 17)),
)
],
),
));
}
}
使用替换函数:
String str = "Some useless words";
String newStr = str.replaceAll(' ', 'n'));